2020 election data

using CSV
using DataFrames
using HTTP

# URL of the raw CSV file from the GitHub Gist
gist_url = ""

# Fetch the CSV data from the Gist URL
csv_data = HTTP.get(gist_url).body

# Read the CSV data into a DataFrame
df =, 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 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.


Single State

[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 Biden 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.


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:

  1. 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.

  2. 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.

  3. Representative sample: The ACS surveys a representative sample of the population, and the data is then weighted to produce estimates for the entire population.

  4. 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.

  5. Wide range of topics: The ACS collects data on various subjects, including demographics, education, employment, income, housing, and more.

AI research and drafting aids

©2024 Richard Careaga. All rights reserved. Last modified: June 27, 2024.