This project analyzes the results of the 2016 election on a county-by-county basis. The only thing you can do right now
is plot the county-wide results. The data is contained in the data directory but before you can use it, you need to
merge the geography data and the voting information. The current data store is MongoDB, so you'll need to have that
installed and running before you run the script.
Running pip -r requirements.txt should get you everything you need (Numpy, Matplotlib, PyMongo, and pyshp).
The election-results-201{2|6}.json files store the voting data harvested from the New York Times election results page.
The county shapefiles come from the Census Bureau.
To merge the geographical and vote data run
./election_analysis.py -o merge-vote-2012 -v data/election-results-2012.json -s data/cb_2015_us_county_5m/cb_2015_us_county_5m.shp
This will merge the polygons for the county with the vote data and store it in Mongo. To do the same for 2016,
just replace 2012 with 2016.
To plot the map for a specific year:
./election_analysis.py -o plot-counties -y {year} -of {result-file}
where {year} is either 2012 or 2016 and {result-file} is the name that you want to dump the map to.
To plot the differential between 2016 and 2012:
./election_analysis.py -o plot-diff -of {result-file}