diff --git a/parser.py b/parser.py index 58feee4..d3709f6 100644 --- a/parser.py +++ b/parser.py @@ -8,6 +8,7 @@ abstVotes = {'CDU/CSU': 0, 'SPD': 0, 'DIE LINKE.': 0, 'BÜ90/GR': 0} invalidVotes = {'CDU/CSU': 0, 'SPD': 0, 'DIE LINKE.': 0, 'BÜ90/GR': 0} notVotes = {'CDU/CSU': 0, 'SPD': 0, 'DIE LINKE.': 0, 'BÜ90/GR': 0} + votes = {'CDU/CSU': 0, 'SPD': 0, 'DIE LINKE.': 0, 'BÜ90/GR': 0} #"Wahlperiode","Sitzungnr","Abstimmnr","Fraktion/Gruppe","Name","Vorname","Titel","ja","nein","Enthaltung","ungültig","nichtabgegeben","Bezeichnung" with open(file, 'r', encoding='utf-8') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') @@ -20,17 +21,26 @@ party = row[3] if row[7] == "1.0": yesVotes[party] += 1 + votes[party] += 1 elif row[8] == "1.0": noVotes[party] += 1 + votes[party] += 1 elif row[9] == "1.0": abstVotes[party] += 1 + votes[party] += 1 elif row[10] == "1.0": invalidVotes[party] += 1 + votes[party] += 1 else: notVotes[party] += 1 # print ergs + yesVotes.update({k: v/votes[k] for k,v in yesVotes.items()}) + noVotes.update({k: v/votes[k] for k,v in noVotes.items()}) + abstVotes.update({k: v/votes[k] for k,v in abstVotes.items()}) + invalidVotes.update({k: v/votes[k] for k,v in invalidVotes.items()}) print("Dafür: ", yesVotes) print("Dagegen: ", noVotes) print("Enhalten: ", abstVotes) print("Ungültig: ", invalidVotes) print("Nicht abgestimmt: ", notVotes) + print("Stimmen gesamt: ", votes)