Crunching a dataset

So with my new Jupyter Notebook setup and taking some data prepared by a political scientist called Prof. Chris Hanretty of Royal Holloway (linked to here on Harvard academic Pippa Norris‘s website) I set about doing quite a bit of crunching on the very useful composite dataset of UK General Elections for 2010, 2015, 2017, Brexit 2016 vote, and 2011 Census data. It’s nice to work with something that someone has obviously already put a lot of work and thought into and is already nice and clean.

I did quite a few plots but here’s one with a nice clear signal (not at all an original finding I must stress), the relationship between proportion of people with a degree in an area and their tendency to vote leave/remain.

A fairly clear linear relationship emerges, more degree holders, fewer leave votes. Also obvious from the data is that Westminster constituencies where more than 30% of the people held degrees (Census 2011 data used for that) were much more likely to be voting heavily remain in 2016. No great surprises there. Places where high numbers of people have degrees also tend to be more supporting of Labour than Tories (I could have chucked in the LD data as yellow dots too, but this was just a little demo of running pandas and matplotlib with Jupyter Notebook on my little RPi3.