< dirkmjk

Articles in category: python

Converting Election Markup Language (EML) to csv

20 July 2018 - For recent Dutch elections, results are available per candidate, per polling station. The data is in the EML format. I wrote a script to convert that to dataframes.

The orientation of Amsterdam’s streets

13 July 2018 - Eight days from now, Amsterdam will have a new metro line traversing the city from north to south. But what about the orientation of the city’s streets?

How to use Python and Selenium for scraping election results

13 May 2018 - The Kiesraad website where election results are published is partly generated using javascript (I think) and therefore not easy to scrape. For this reason, this seemed like a perfect project to explore Selenium.

How to do fuzzy matching in Python

15 October 2017 - Statistics Netherlands (CBS) has an interesting dataset containing data at the city, district and neighbourhood levels. However, some names of neighbourhoods have changed, specifically between 2010 and 2011 for Amsterdam. For example, Bijlmer-Centrum D, F en H was renamed Bijlmer-Centrum (D, F, H).

Python script to import .sps files

11 April 2017 - In a post about voting locations (in Dutch) I grumbled a bit about inconsistencies in how Statistics Netherlands (CBS) spells the names of municipalities and why don’t they include the municipality codes in their data exports. This afternoon, someone who works at CBS responded on Twitter. She had asked around and found a workaround: download the data as SPSS. Thanks!