A collection of scripts and tools to analyze the Maine RCV data from the 2018 2nd Congressional District election
Run each sequentially-numbered script in order. The outputs of the 3rd and 4th scripts are the most useful.
- Downloads the raw data from the Maine Secretary of State website and compares md5 hashes
- Converts the
xlsx
files into CSV format, using@
as the field separator (and taking only the last 5 columns -- e.g. dropping id and location information). - Codes the CSV-formatted files into a sequence of 5-character votes, denoting the ranking from left to right by the last initial of candidate. A "U" or "O" represents an undervote or overvote, respectively.
- Formats and tabulates the 5-string input per official ballot rules (double undervotes, overvotes, etc).
- Simulates the instant run-off process, outputting intermediate and final results straight to the console.
- Outputs data relevant for determining ranked pairs winner, along with 3 eigenvector-based rankings.
Scripts 1-4 use a combination of wget
, md5sum
, csvkit
, awk
, and sed
. Script 5 uses only a base install of Python 3, while script 6 requires numpy.
Do whatever you want with these scripts! Please let me know if you find something interesting or substantively improve the data import/cleaning steps.