Raw Data

Getting the raw data for Canadian federal elections is an exercise in frustration. It's available from Elections Canada and the government's Open Data Portal but in several different formats and sometimes with file format errors, multiple names for the same political party, etc.

I've collected what's available, cleaned it up, and put it all into a common format. The programs to do this are freely available on GitHub if others want to extend or improve upon them.

The data is available by candidate and by riding, with one file for each election. There is also a file for every candidate across all elections, going back to 1867 (download).

Finally, several other files are available with an overview of each election as well as the parties involved.

The really raw data is from:

  • Elections Canada has data to the polling station level for 39, 40, 41, and 42. Use the “Poll results” for all of Canada.
  • For elections 1 - 40 there is one large CSV file with data to the riding level at the the Open Data Portal), retrieved on 2019-10-18.
  • For election 43 (just held at the time of writing) there are preliminary results from Elections Canada.

To harmonize this, we drop the poll-by-poll data and go to just the riding level.

There is some overlap in the data sets. We prefer the first data set to the second in those cases.

The Open Data Portal also includes a link to data for the 38th election. However, it's in a different format and does not provide the same level of detail.