Computer coding underpins our everyday lives: from traffic lights to smartphone applications to the webpage you’re reading this on. One of the priorities of the Chief Executive of the Civil Service - John Manzoni - is to improve the digital skills of Civil Servants. The analytical community here in Cabinet Office were keen to learn if coding techniques could be used to improve the work we do and help to make us more efficient. We collaborated with the Open Knowledge Foundation to put together a ten week, introductory coding club to see how coding could be applied to government work. After attending the course, I wanted to share with you what I found useful.
As an economist in government, I regularly work with large data sets and was interested in any techniques that would help me to clean, analyse and present data in more efficient ways. We were introduced to an open source application called OpenRefine that can be used for cleaning and transforming data sets. We learnt how unwanted whitespace and misspelt words can easily be deleted and corrected in large datasets. In the past I have painstakingly gone through spreadsheets correcting for spelling errors so this was a real revelation.
We were taught some basics of the Python programming language and used it within the IPython notebook interface. We learnt how to format data, removing rows and columns as well as carrying out some basic functions on the data. The advantage of using code to do this instead of a programme like Microsoft Excel is that every change you make to the data is logged as you go through. This is great for keeping track of what you are doing and for quality assurance purposes. We also learnt how to use Python to help us present data. Presenting data in an interesting and engaging way is important for government analysts who often have to communicate their findings to non-analyst audiences and make a quick impact. We used libraries in Python such as Matplotlib and Folium to construct charts and choropleth maps.
A ten week code club does not make a computer programmer! But the course did open my eyes to the potential of using coding in government work and I will certainly be calling on some of these techniques when tackling my next big dataset. After a successful first run, Code Club has now been extended, and continues to run weekly.
Have you ever used any of the above tools to analyse and present data? If you have any good tips, I’d really like to hear about them.