In order to facilitate broader discussion of the election, we have written a set of python scripts to download and organize data relating to the election. There is still a fairly high barrier to obtaining election results, so we wanted to make a clean source available for those interested. In addition to the series discussed in our previous post (here), we have included data on voting machines for those who wish to explore questions related to the recount.The code will download election results, graph them, and merge them into a .csv for statistical analysis.
We have made them available through the following sources:
To run it, install Python (we suggest Anaconda), open a terminal and run the “Main.py” program from the file in which it was downloaded after editing options. It is likely that with a fresh installation of Python, additional modules will be necessary. This can be done by opening a terminal and typing “pip install <module name>” without quotes, and the required module substituted for <module name>.
Series available (County-level):
- 2016 Election (President, House, Senate, Governor)
- 2012 Election (President, House, Senate, Governor)
- 2008 Election (President, House, Senate, Governor)
- 2004 Election (President, House, Senate, Governor)
- Economic Statistics (unemployment, income, establishments, industries)
- Demographics (race, age, gender, education)
Series provided but not merged (County-level):
- 2002 industry composition
- Voting Rights Act coverage
- Voting machine type (paper, electronic, etc.)
The available options are explained and edited in the “Main.py” file. We will be gradually updating our code to include options for more series, as well as merging the “extra” series currently not merged.
Any coding contributions or comments are much appreciated.