Table · house-results
US House election results, 1976-2024
District returns for every US House election from 1976 to 2024, including special elections: one row per candidate per ballot line, from the MIT Election Data + Science Lab.
- Updates
- Every 2 years
- Coverage
- —
- Current version
- —
- Last published
- —
- Validation
- —
- License
- CC0 1.0
- Commercial use
- Allowed
Preview
Use the API
The examples follow the rows picked above. See the docs for versions, caching and errors.
curl
# All rows (.json or .csv)
curl -s "https://api.electiondata.dev/v1/house-results/table/all.json"
# The whole table in one file
curl -sO "https://api.electiondata.dev/v1/house-results/download/house-results.csv" Python (polars)
import polars as pl
# All rows
df = pl.read_csv("https://api.electiondata.dev/v1/house-results/table/all.csv")
# The whole table
everything = pl.read_parquet("https://api.electiondata.dev/v1/house-results/download/house-results.parquet") JavaScript
const res = await fetch("https://api.electiondata.dev/v1/house-results/table/all.json");
if (!res.ok) throw new Error((await res.json()).detail); // errors are problem+json
const { meta, rows } = await res.json();
console.log(meta.rows, rows[0]); Downloads
The whole dataset in one file. Parquet keeps the column types and is much smaller.
- house-results.csv CSV
- house-results.parquet Parquet
Schema
Rows are identified by year, state_po, district, stage, special, race_row.
The rows are also split into one file per value of year.
Tables up to 50,000 rows also have a single table/all file.
| Column | Type | Unit | Can be empty | Description |
|---|---|---|---|---|
| year key partition | year (YYYY) | — | no | Year of the election |
| state | text | — | no | State name in upper case |
| state_po key | text | — | no | USPS state code |
| state_fips | integer | — | no | State FIPS code |
| state_cen | integer | — | no | Census Bureau state code |
| state_ic | integer | — | no | ICPSR state code |
| state_id | text | — | no | Location id in the shared registry (us-<usps>) |
| office | text | — | no | Always US HOUSE |
| district key | integer | — | no | District number; 0 for an at-large seat |
| stage key | text | — | no | GEN (general) or PRI (Texas 1996 special open primaries) |
| runoff | true / false | — | yes | True for a runoff; null where MEDSL doesn't record it (2006-2018) |
| special key | true / false | — | no | True for a special election to fill a vacancy |
| race_row key | integer | — | no | Position of the row within its race in MEDSL's file |
| candidate | text | — | no | Candidate as the House Clerk prints it, upper case; WRITEIN for unnamed write-ins |
| party | text | — | yes | Ballot line (party) as reported |
| writein | true / false | — | no | True for write-in votes |
| fusion_ticket | true / false | — | no | True on the extra party lines of a candidate nominated by several parties (the main line is false) |
| mode | text | — | no | Vote mode; always TOTAL in this file |
| candidatevotes | integer | votes | yes | Votes on this ballot line; null for an uncontested race with no reported count |
| totalvotes | integer | votes | yes | Total votes in the race as MEDSL reports it |
| candidate_total_votes | integer | votes | yes | The candidate's votes on all ballot lines in the race (fusion voting); null for unnamed write-ins |
| unofficial | true / false | — | no | True where MEDSL took the figures from unofficial results |
| version | date (YYYY-MM-DD) | — | no | Date MEDSL finalized the row |
Source and license
- Source
- MIT Election Data and Science Lab, U.S. House 1976-2024
- Publisher
- MIT Election Data and Science Lab (MEDSL)
- License
- CC0 1.0 (public domain dedication) (
CC0-1.0) - Commercial use
- Allowed
Credit the source with this exact text:
MIT Election Data and Science Lab, 2017, "U.S. House 1976–2024", https://doi.org/10.7910/DVN/IG0UN2, Harvard Dataverse, V15, UNF:6:cIJWG41N8qe3Kyf7oKuPdw== [fileUNF]
Checked every 7 days. If the source hasn't changed in 3 years, the status page flags it as stale.
Endpoints
Every URL for this dataset. To pin the current version, put it after the id:
/v1/house-results@<version>.
The API reference describes each response.
| What | URL |
|---|---|
| Metadata: version, coverage, downloads, validation | /v1/house-results |
| Versions and monthly snapshots | /v1/house-results/versions |
| Partitions | /v1/house-results/locations |
| Rows for one year (JSON) | /v1/house-results/table/{year}.json |
| Rows for one year (CSV) | /v1/house-results/table/{year}.csv |
| All rows in one file (tables up to 50,000 rows) | /v1/house-results/table/all.json |
| Whole dataset (CSV) | /v1/house-results/download/house-results.csv |
| Whole dataset (Parquet) | /v1/house-results/download/house-results.parquet |