I’ve created a web-service that supplies an automatically updated history of UK political polling data. Clicking on the link below will download an up-to-date Excel sheet containing the figures.
Data sources
The data comes from three sources. Should anyone wish to make use of the data from this service they should credit these.
The first is Mark Pack’s superb spreadsheet of historical polling data. This is the go-to resource for historical UK polling data and you will often see it referenced in blogs or the press.
However it has two drawbacks if you want to use it for looking at polling results as a time-series. One is that the data is arranged across tabs, one for each electoral cycle. This makes it readable, and presumably more maintainable, but isn’t a format that accommodates analysis of the data as a continuous series. The other drawback is that, quite understandably, it is only updated every 3 months so it doesn’t have the latest data. It’s these two restrictions I wanted to overcome.
The second source of party polling data is Wikipedia. There is a dedicated page for UK polling which is updated very quickly indeed when new data becomes available. I make use of this to fill in the data that has been published since the last Mark Pack update.
An additional set of data comes from Ipsos Mori’s monthly political survey which provides party leader and government satisfaction ratings going back to 1979.
On top of this I’ve added a couple of extra data sets which help with analysis.
One is the actually general election results. These are the GB-wide results, excluding Northern Ireland, as this what the polls correspond to.
The other is a set that indicates when the different parties entered power. This can be used for analysis based on whether a party was in government or opposition during a period of polling.
Data formats
The data is available in different formats.
As a single Excel sheet using the link previously given: http://www.nickstricks.net/polling/file/uk_polls.xlsx
There are also two means of downloading the individual sets. These can be used to load into an SQL database or other tool for analysing the data. In a subsequent post I’ll illustrate a Python client library for doing this.
You can download as csv files:
http://www.nickstricks.net/polling/file/parties.csv
http://www.nickstricks.net/polling/file/leaders.csv
http://www.nickstricks.net/polling/file/in_power.csv
http://www.nickstricks.net/polling/file/general_elections.csv
Alternatively you can download the same information directly into a browser window as text:
http://www.nickstricks.net/polling/data/parties
http://www.nickstricks.net/polling/data/leaders
http://www.nickstricks.net/polling/data/in_power
http://www.nickstricks.net/polling/data/general_elections
A note on dates
The date that appears against an entry in the party polling sheet is the final date on which data was collected, which will usually be a couple of days before publication.
On the Mori leader ratings data I’ve set the date to the first of the month for simplicity.
Technical details
The data is served up using a Python Flask server, hosted on Amazon Web Services but proxied via this website. I previously hosted on Scalingo which I found reliable and easy to use, but after the introduction period it was costing more than I was prepared to pay for a service with virtually no traffic. I used OpenShift for an earlier project but I found it to be unreliable, with Python not installing properly.
The code is here on git if it’s of any interest.
Caveat
I take no responsibility for the accuracy or availability of the data.