Check the setup
- Python 3.10 or newer
- A notebook environment such as Jupyter or Google Colab
- An internet connection
County-level U.S. presidential election returns for building result maps and turnout comparison tools from MIT Election Data and Science Lab files.
From source to product signal
MEDSL publishes county presidential returns on Harvard Dataverse. Start with one election year and two-party totals. County shapefiles, third-party votes, and certified state files can disagree, and this is not precinct data.
Install the packages, then run the notebook cell.
python -m pip install pandas
import pandas as pd
returns = pd.read_csv(
"https://dataverse.harvard.edu/api/access/datafile/6188156",
encoding="latin-1",
)
print(returns.head())Test a useful signal
Test whether county returns can power a bounded result-map prototype.
MIT Election Data and Science Lab is an academic source. Last verified 2026-08-18. Temporal coverage: presidential general elections compiled by MEDSL.