17 Apr 2013 (age 22) Politics

Raw data for the 2013 Liberal leadership results: you're welcome

Good on the Liberal Party of Canada for releasing riding-by-riding results as soon as the leadership vote was over. The website they used was decent enough for drilling down to a particular riding, but unfortunately they didn't publish machine-readable data that can be parsed and analysed with any depth.

This wasn't a close race by any stretch of the definition, with Justin Trudeau snagging just over 80% of the points and 79% of the popular vote. But even the most landslidey of landslide victories (I'm serious, I think there are only two ridings in BC that he didn't win) is no reason to avoid digging into the numbers.

Edit: Matthew Carroll has released data in a similar format as I did, and his methods of collection were more reliable than mine. So I'll take mine offline, leave the rest of this post up for posterity, and urge you to check out his version. Best not to have too many different copies floating around. Well done Matthew.

Without the option to download a raw data file of the riding-by-riding results, I went ahead and created one (well, a few in different formats). Copy and pasting values from the website was actually not too onerous once I got a system going. So for the benefit of all you curious political enthusiasts out there, here are the complete results in a few different formats:

  1. Google Spreadsheet: View the riding-by-riding data in your browser. Includes a couple pivot tables to summarize the results by province.
  2. CSV File: Open this in Excel and go nuts. Includes calculated vote counts alongside the vote percentages for each riding.
  3. JSON File (Flat): Standard machine-readable format. Formatted like so: { "Province or territory": "Alberta", "Riding": "Fort McMurray-Athabasca", "Eligible voters": "105", "Blank ballots": "1", "Ballots cast": "77", "Turnout": "73.33%", "Cauchon": "2.63157", "Coyne": "1.31578", "Hall Findlay": "5.26315", "McCrimmon": "1.31578", "Murray": "13.15789", "Trudeau": "76.31578" }
  4. JSON File (Multidimensional): Standard machine-readable format. Formatted like so: { "Province or territory": "Alberta", "Riding": "Fort McMurray-Athabasca", "Eligible voters": "105", "Blank ballots": "1", "Ballots cast": "77", "Turnout": "73.33%", "Vote percentage": { "Cauchon": "2.63157", "Coyne": "1.31578", "Hall Findlay": "5.26315", "McCrimmon": "1.31578", "Murray": "13.15789", "Trudeau": "76.31578" } }

I didn't include vote counts in the JSON files because they were not explicitly reported. However, it's pretty simple to calculate the number of votes cast for each candidate by multiplying their vote percentage by the total ballots cast.

Obligatory disclaimer: I copy and pasted this data on 17 April 2013 from the Liberal Party's results page at https://www.vote2013leadership.ca/results/. Human error is always a possibility (but I tried really hard to avoid mistakes). Let me know if you find any problems.

Sam Nabi