Skip to content

skbormann/wahlomat-extended-analysis

Repository files navigation

wahlomat-extended-analysis

This is an extension of the analysis by Reddit user /u/microraptor/ of the questionaires from www.wahl-o-mat.de. Check out his repo for the original analysis. His analysis in return have been inspired by Reddit users /u/d_loose/ and /u/askLubich/. The analysis script generates a correlation matrix and a principal component analysis map, where also clusters are marked.

The analysis is extended in the sense that it is run for available wahl-o-mat questionnaires. Further explanations of the extensions to the original analysis are documented in the section Changes. The core analysis was not changed except for minor fixes to deal with errors in the input files.

Analysis steps

  1. Run the file get_zip_files.py to download all zip-files containing the questionaires from the website www.wahl-o-mat.de and unzip them in new folder named "data".
  2. Run the file load_modules.py to run the analysis function from analysis.py for all downloaded modules. The graphs generated by the analysis are placed in a newly created folder named "graphs". If a folder with the same name exists already, then the graphs will be placed there.

The default settings used by the analysis function don't work for all questionnaires, mostly due to lack of parties which participated in the questionnaires. Therefore, you can run the file failed_analysis.py to get the data for these elections placed into new dataframes. NB: The list used in this script is based on my own previous analysis and creates global variables/dataframes with names based on the election for easier analysis.

What is the wahl-o-mat?

According to the website (in German) the

Wahl-O-Mat is a question-and-answer tool that shows which party admitted to an election is closest to one's own political position.

Explanation of the results

For an overview of how to interpret the analysis check out askLubich's repo or his German explanation.

Changes

  • Added get_zip_files.py to download all questionnaires
  • Added load_modules.py and deal with elections who have their modules.js file encoded with latin1 instead utf8.
  • Minor changes to the regular expressions used to read the data from the file modules.js to deal with some inconsistencies across elections.
  • Created an analysis function in analysis.py to make it to possible to iterate over all elections.
  • Added build_dataframe.py, a WIP file to create one dataframe containing the data from all elections.

Things to add/change

  • Add function to select and download individual elections (download index file, extract elections and create menu or download files on election name)
  • Add possibility to run analysis for individual election.
  • Add update function to build_dataframe.py to allow easier updating of the dataframe after for every new election.

Dependencies for Local Execution

See requirement.txt. This script requires to have Python 3.8+. The dependencies are the same as for microraptor's analysis.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages