Wahlen letzte Wahl

Wahlen 2023


letztewahl.csv
k p sitze_alt w_alt
1 1 5 13.7
1 2 1 6
1 3 7 17.3
1 4 10 26.7
1 7 1 3.3
1 9 0 0.3
1 12 0 1.6
1 13 5 14.1
1 14 0 0.2
1 16 0 1.6
1 31 6 14
1 35 0 1.2
2 1 2 8.4
2 2 2 9.9
2 3 4 16.8
2 4 7 30
2 7 1 4.2
2 9 0 0.6
2 13 4 13.6
2 14 0 0.4
2 16 1 2.5
2 31 3 9.7
2 35 0 3.9
3 1 1 15.6
3 2 3 25.5
3 3 1 13.5
3 4 2 24.7
3 7 0 0.7
3 13 1 12.2
3 14 0 0.1
3 31 1 7.1
3 35 0 0.5
4 2 1 39.2
4 3 0 22.3
4 4 0 36.3
4 35 0 2.2
5 1 1 23.1
5 2 1 18.4
5 3 0 13.8
5 4 2 36.9
5 7 0 0.6
5 13 0 2.6
5 31 0 4.6
5 35   0
6 1 0 11.6
6 2 0 36.7
6 3 0 2.9
6 4 1 37.3
6 35 0 11.5
7 1   0
7 2 0 35.8
7 4 1 64.2
8 2 1 63
8 3 0 28.2
8 4   0
8 13 0 2.7
8 35 0 6
9 1 0 14.7
9 2 1 23.8
9 3 0 9.3
9 4 1 26.6
9 7 0 0.8
9 13 1 19.2
9 31 0 5.5
9 35   0
10 1 1 15.4
10 2 2 18.5
10 3 2 21.2
10 4 1 20.2
10 7 0 0.7
10 8 0 3.3
10 13 1 12.5
10 16 0 0.7
10 31 0 5.4
10 35 0 2.1
11 1 1 18.5
11 2 1 16.2
11 3 1 18.4
11 4 2 25.9
11 7 0 1.2
11 13 1 11.4
11 14 0 0.6
11 31 0 6.8
11 35 0 0.9
12 1 0 6
12 2 0 4.9
12 3 2 32.7
12 4 0 12.4
12 5 1 15.3
12 7 0 2
12 13 1 17.7
12 16 0 0.3
12 31 1 5.7
12 35 0 3
13 1 1 16.5
13 2 1 9.7
13 3 2 21.8
13 4 2 25.1
13 7 0 3.5
13 13 1 18
13 16   0
13 31 0 5.3
13 35 0 0.1
14 1 0 11
14 2 0 2.1
14 3 1 26.2
14 4 1 39.5
14 7 0 1.9
14 12 0 3.2
14 13 0 6.8
14 16 0 3.4
14 31 0 5.9
14 35   0
15 1 0 48.4
15 2 0 0
15 4 1 49.5
15 35 0 2.1
16 2 1 61.3
16 3 0 8.7
16 4 0 29.1
16 35 0 0.9
17 1 2 15
17 2 2 19.4
17 3 2 12.7
17 4 4 31.3
17 7 0 1.6
17 13 1 10.5
17 14 0 0.3
17 16 0 0.9
17 31 1 7.3
17 35 0 1
18 1 1 13.6
18 2 1 25.4
18 3 2 17.1
18 4 1 29.9
18 7   0
18 13 0 5.5
18 16   0
18 31 0 8.3
18 35   0
19 1 2 13.6
19 2 2 13
19 3 3 16.5
19 4 6 31.5
19 7 1 3.6
19 9   0
19 13 1 9.8
19 16 0 1
19 31 1 8.5
19 35 0 2.6
20 1 0 11.5
20 2 1 15
20 3 1 12.6
20 4 3 36.7
20 7 0 2.7
20 13 1 10.6
20 16 0 2.8
20 31 0 8.1
20 35   0
21 1 2 20.5
21 2 2 18.2
21 3 1 14.1
21 4 1 11.7
21 9 0 0.8
21 13 1 12.1
21 16 0 1.1
21 18 1 16.9
21 31 0 1
21 35 0 3.6
22 1 5 23.3
22 2 0 2.8
22 3 5 20.4
22 4 3 17.4
22 7 0 1.3
22 9 0 4.1
22 13 4 19.7
22 14 0 0.1
22 16 0 0.3
22 31 2 8.4
22 35 0 2.3
23 1 1 16.5
23 2 3 34.8
23 3 1 15.1
23 4 2 19.8
23 8 0 1
23 9   0
23 13 1 10.6
23 31 0 0.8
23 35 0 1.5
24 1 1 22.3
24 2 0 4.2
24 3 1 16.6
24 4 0 12.7
24 7   0
24 9 1 14.1
24 13 1 20.8
24 16   0
24 31 0 9.1
24 35 0 0.2
25 1 2 17.9
25 2 1 8
25 3 2 14.7
25 4 2 13.7
25 7 0 0.7
25 9 1 7.4
25 13 3 24.6
25 16 0 0.1
25 31 1 5.4
25 33 0 5.4
25 35 0 2
26 1 0 9.1
26 2 1 22.8
26 3 1 27
26 4 0 14.5
26 7 0 1.4
26 8 0 9.6
26 13 0 15.6
26 31   0
26 35   0

letztewahl_ch.csv

p sitze_alt w_alt
1 29 15.1
2 28 13.8
3 39 16.8
4 53 25.6
7 3 2.1
8 0 0.3
9 2 1
12 0 0.3
13 28 13.2
14 0 0.1
16 1 1
18 1 0.8
31 16 7.8
33 0 0.2
35 0 1.8

Code

echo "letztewahl.csv"
read path level_kantone/ "https://ogd-static.voteinfo-app.ch/v4/ogd/sd-t-17.02-NRW2023-parteien.json"
rename kanton_nummer k, partei_id p, letzte_wahl_anzahl_gewaehlte sitze_alt, letzte_wahl_partei_staerke w_alt
project k, p, sitze_alt, w_alt

// fusion CVP (2) BDP (32) zu Mitte (34)
dup
select p=2 or p=32 or p=34
project k, sitze_alt sum, w_alt sum
rename sitze_alt_sum sitze_alt, w_alt_sum w_alt
extend p = 2
swap
select p != 2 and p != 32 and p != 34
union
update w_alt = round(10*w_alt)/10
project k, p, sitze_alt, w_alt
order k 1, p 1
write "letztewahl.csv"
print

echo "letztewahl_ch.csv"
read path level_ch/ "https://ogd-static.voteinfo-app.ch/v4/ogd/sd-t-17.02-NRW2023-parteien.json"
rename partei_id p, letzte_wahl_anzahl_gewaehlte sitze_alt, letzte_wahl_partei_staerke w_alt
project p, sitze_alt, w_alt

// fusion CVP (2) BDP (32) zu Mitte (34)
dup
select p=2 or p=32 or p=34
project sitze_alt sum, w_alt sum
rename sitze_alt_sum sitze_alt, w_alt_sum w_alt
extend p = 2
swap
select p != 2 and p != 32 and p != 34
union
update w_alt = round(10*w_alt)/10
project p, sitze_alt, w_alt
order p 1
write "letztewahl_ch.csv"
print