Sources
2020 election data
using CSV
using DataFrames
using HTTP
# URL of the raw CSV file from the GitHub Gist
gist_url = "https://gist.githubusercontent.com/technocrat/18810a6c1c3d6d2c443876f06df0ad28/raw/a4b7ebf2d6429c5224417a133caa61dedfaa433e/2020vote.csv"
# Fetch the CSV data from the Gist URL
csv_data = HTTP.get(gist_url).body
# Read the CSV data into a DataFrame
df = CSV.read(IOBuffer(csv_data), DataFrame)
# Now `df` contains the data from the CSV file
[1] | Wikiwand is a Wikipedia reader showing the same content.] |
[2] | The 2020 election used the 2010 Census to allocate the Electoral College results among the states, and the 2024 election will use the 2024 Census. Seventeen states were affected through losing or gaining votes. See summary. |
Polls used[3]
Links to original sources were collected from RealClearPolling.com Results were taken from the most detailed reports found and had to include the number of respondents (\(N\)). In cases where presidential preference questions were directed to subgroups, the applicable \(N\) was applied.
Multistate
Single State
Arizona
Georgia
Michigan
Pennsylvania
[Franklin & Marshall College Poll: conducted
March](https://www.fandmpoll.org/franklin-marshall-poll-release-april-2024)
Nevada
North Carolina
Wisconsin
[3] | Results selected for analysis here are for two-way preference questions if asked, except in cases in which Robert F. Kennedy, Jr. qualified for the ballot prior to poll. For polls with only multiple choices in addition to Harris and Trump, their respective percentages of responses were recorded. In all cases those percentages were normalized to 100% to reflect the relative, not absolute, support of the two candidates. |
Demographics
The U.S. Census Bureau's American Community Survey (ACS) is an ongoing survey that provides vital information on a yearly basis about the United States and its people. U.S. Census Bureau, 2022 American Community Survey 1-Year Estimates offers a snapshot of various demographic, social, economic, and housing characteristics across the nation.
Key points about the data source:
Conducted by the U.S. Census Bureau: The ACS is administered by the U.S. Census Bureau, which is the primary government agency responsible for collecting and providing data about the American people and economy.
Annual survey: Unlike the decennial census, which is conducted every ten years, the ACS is conducted annually, providing more up-to-date information on the U.S. population.
Representative sample: The ACS surveys a representative sample of the population, and the data is then weighted to produce estimates for the entire population.
1-Year Estimates: The 1-Year Estimates provide data for geographic areas with populations of 65,000 or more. These estimates are the most current but have a larger margin of error compared to 5-Year Estimates due to the smaller sample size.
Wide range of topics: The ACS collects data on various subjects, including demographics, education, employment, income, housing, and more.