Skip to content
No description or website provided.
Branch: master
Clone or download
Latest commit 85dff16 Mar 7, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
kiesraad
.gitignore
README.md
setup.py

README.md

The Dutch election council publishes election results in two formats:

  • A website Verkiezingsuitslagen where for each election, each municipality has its own page with local results;
  • Files in Election Markup Language (EML), published at the national government’s data portal.

Background (in Dutch)

Scrape Verkiezingsuitslagen website

This will produce a csv file containing results per municipality.

Example:

from kiesraad import scrape

scrape.scrape('TK20170315')
df = scrape.parse_downloaded_pages('TK20170315')

Parse EML files

This will produce csv files for each municipality, containing results at polling station level. If desired, these can include votes per candidate.

Example:

from pathlib import Path
import pandas as pd
from kiesraad import parse_eml

source = Path('../data/TK2017')
dfs = parse_eml.parse_eml(source)
target = source / 'csv'
target.mkdir(exist_ok=True)
for name, df in dfs.items():
    path = target / f'{name}.csv'
    df.to_csv(path, index=False)

Caveat

Please check the results; they are not guaranteed to be accurate.

You can’t perform that action at this time.