A project for automatically scraping these Wikipedia articles:
- United States presidential election, 2016
- United States presidential election, 2012
- United States presidential election, 2008
- United States presidential election, 2004
- United States presidential election, 2000
They are scraped for the state-level popular vote results, and then the methodology of my blog post, Fair, Efficient State-wise Electoral College Vote Allocation, is applied.
The GitHub native rendering of the notebook doesn't always work, but there is always nbviewer.jupyter.org
If you have Docker, the jupyter/scipy-notebook image on Docker hub has all needed
dependencies. The following assumes you have a typical UID = 1000. If not, you can
try adding --user 5000 --group-add users
to the options in the command below. See
here for
full details.
docker run -it --rm -e JUPYTER_ENABLE_LAB=yes -p 8888:8888 --mount type=bind,source="$(pwd)",target=/home/jovyan/work jupyter/scipy-notebook:latest
- Open the notebook file under the work/ folder and run it, or play with it as you see fit.
A Dockerfile and .devcontainer folder are provided,
which make it easy to launch the notebook inside Visual Studio Code using its
Remote-Containers extension, via the
Remote-Containers: Open Folder in Container...
command.
The notebook was developed on Linux Mint, and the following instructions should be easily translatable to other Linux environments, or even any system that can run Anaconda.
- Install Anaconda.
conda env create -f environment.yml
source activate electoral-fair
jupyter notebook
- Open the notebook files and run it, or play with it as you see fit.