Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration of voting results from Bundeswahlleiter #34

Merged
merged 1 commit into from
Oct 7, 2021

Conversation

Henje
Copy link

@Henje Henje commented Oct 5, 2021

This PR deals with loading the results of Bundestagswahlen. It fetches the corresponding CSV file and parses them into usable pandas DataFrames. The column names are taken from the CSVs. This PR aims to close bundesAPI/sofortmassnahmen#35.

There are still some things to consider. The CSVs from the Bundeswahlleiter contain all electoral districts as well as the summed results for each Bundesland as well as a some over the whole country. These could be removed, because the information is implicit from the district results. Some column names could also be improved, for example, until 2017 there was a column Wähler which was renamed to Wählende in 2021, should these all be renamed to Wählende or would the english voter be easier to use? Also, the party names differ from year to year. In older results only the party short name was used, whereas in recent results the full name is used (SPD vs Sozialdemokratische Partei Deutschlands). If we would want to change the names to the short names, we would need a list of all the associations for all parties or at least all major parties. Also the ids for non-district rows are all over the place, I have to see how to normalize them.

Some examples how the data can be used:

bwl = Bundeswahlleiter()
results2021 = bwl.load_results(2021)
results2021[["name", "Sozialdemokratische Partei Deutschlands"]]
results2021[results2021["name"] == "Flensburg - Schleswig"]

@LilithWittmann LilithWittmann merged commit b898ff1 into bundesAPI:main Oct 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API zum Abruf der Bundestagswahldaten und bundeswahlleiter.de
2 participants