Congressional Election Results

The Federal Election Commission keeps a record of vote tallies for all Presidential and Congressional elections going back to 1982. But trying to make sense of these records is a headache because the format changes just about every year. The vagaries of state election laws also mean it’s not always simple to figure out how many votes a candidate received. In New York, for example, candidates often run under the aegis of several different parties, so the same candidate can appear in the results table several times.

TIME Labs has attempted to standardize this data for the past five cycles of Congressional elections using a script that draws out the relevant information from each file, combines vote tallies in cases like New York, and outputs clean JSON and CSV files with the results. A given election looks like this:

2006_AZ_01,2006,”Renzi, Rick”,AZ,01,105646,Republican
2006_AZ_01,2006,”Simon, Ellen”,AZ,01,88691,Democratic
2006_AZ_01,2006,”Schlosser, David”,AZ,01,9802,Libertarian

The data is available for download here, or you can poke around in the Github repository if you want to see how it’s generated from the government’s Excel files. (Short answer: Lots of if/else statements.) As always, be sure to check any data you use against the original source. We tried to allow for every contingency, but there may be cases like runoff elections that aren’t fully accounted for. All suggestions for improvements are welcome.