re-added table, percentages in comment below

This commit is contained in:
Lillian Oostrom 2022-05-25 15:48:55 +02:00
parent acdeab3788
commit 6c34aa2265
2 changed files with 393 additions and 129 deletions

File diff suppressed because one or more lines are too long

View file

@ -28,7 +28,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 1, "execution_count": 49,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -38,7 +38,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 2, "execution_count": 50,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -59,7 +59,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 51,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -68,7 +68,7 @@
"<AxesSubplot:title={'center':'Plot van de gemeenten uit de CBS Wijk- en buurtkaart 2021'}>" "<AxesSubplot:title={'center':'Plot van de gemeenten uit de CBS Wijk- en buurtkaart 2021'}>"
] ]
}, },
"execution_count": 3, "execution_count": 51,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -101,7 +101,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 4, "execution_count": 52,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -177,7 +177,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 5, "execution_count": 53,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -186,7 +186,7 @@
"Text(0.5, 1.0, 'Stembureaus op de gemeentekaart van het CBS')" "Text(0.5, 1.0, 'Stembureaus op de gemeentekaart van het CBS')"
] ]
}, },
"execution_count": 5, "execution_count": 53,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -221,7 +221,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 6, "execution_count": 54,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1014,7 +1014,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 7, "execution_count": 55,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1103,7 +1103,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 8, "execution_count": 56,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1213,7 +1213,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 9, "execution_count": 57,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1233,7 +1233,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 10, "execution_count": 58,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -1645,7 +1645,7 @@
"[9275 rows x 40 columns]" "[9275 rows x 40 columns]"
] ]
}, },
"execution_count": 10, "execution_count": 58,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -1657,7 +1657,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 59,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1670,7 +1670,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 12, "execution_count": 60,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -1679,7 +1679,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 13, "execution_count": 61,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2104,7 +2104,7 @@
"[9275 rows x 41 columns]" "[9275 rows x 41 columns]"
] ]
}, },
"execution_count": 13, "execution_count": 61,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2121,7 +2121,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 14, "execution_count": 62,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2546,7 +2546,7 @@
"[8089 rows x 41 columns]" "[8089 rows x 41 columns]"
] ]
}, },
"execution_count": 14, "execution_count": 62,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2581,7 +2581,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 15, "execution_count": 63,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2590,7 +2590,7 @@
"<AxesSubplot:>" "<AxesSubplot:>"
] ]
}, },
"execution_count": 15, "execution_count": 63,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -2622,7 +2622,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 16, "execution_count": 64,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2631,7 +2631,7 @@
"<AxesSubplot:>" "<AxesSubplot:>"
] ]
}, },
"execution_count": 16, "execution_count": 64,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -2663,7 +2663,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 17, "execution_count": 65,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2672,7 +2672,7 @@
"<AxesSubplot:>" "<AxesSubplot:>"
] ]
}, },
"execution_count": 17, "execution_count": 65,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -2703,7 +2703,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 18, "execution_count": 66,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2753,7 +2753,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 19, "execution_count": 67,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2903,7 +2903,7 @@
"[151108 rows x 4 columns]" "[151108 rows x 4 columns]"
] ]
}, },
"execution_count": 19, "execution_count": 67,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -2924,7 +2924,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 20, "execution_count": 68,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -2968,7 +2968,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 21, "execution_count": 69,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -3125,7 +3125,7 @@
"[3 rows x 38 columns]" "[3 rows x 38 columns]"
] ]
}, },
"execution_count": 21, "execution_count": 69,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -3160,7 +3160,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 22, "execution_count": 70,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -3169,7 +3169,7 @@
"<AxesSubplot:>" "<AxesSubplot:>"
] ]
}, },
"execution_count": 22, "execution_count": 70,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -3194,7 +3194,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 23, "execution_count": 71,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -3203,7 +3203,7 @@
"<AxesSubplot:>" "<AxesSubplot:>"
] ]
}, },
"execution_count": 23, "execution_count": 71,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -3233,7 +3233,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 24, "execution_count": 72,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -3280,7 +3280,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 25, "execution_count": 73,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -3299,7 +3299,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 26, "execution_count": 74,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -3454,7 +3454,7 @@
"[140002 rows x 5 columns]" "[140002 rows x 5 columns]"
] ]
}, },
"execution_count": 26, "execution_count": 74,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -3471,7 +3471,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 75,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -3706,7 +3706,7 @@
"[5 rows x 46 columns]" "[5 rows x 46 columns]"
] ]
}, },
"execution_count": 27, "execution_count": 75,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -3750,7 +3750,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 28, "execution_count": 76,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -4175,7 +4175,7 @@
"[140002 rows x 46 columns]" "[140002 rows x 46 columns]"
] ]
}, },
"execution_count": 28, "execution_count": 76,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -4191,7 +4191,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 29, "execution_count": 77,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -4309,7 +4309,7 @@
"[68131 rows x 3 columns]" "[68131 rows x 3 columns]"
] ]
}, },
"execution_count": 29, "execution_count": 77,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -4321,7 +4321,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 30, "execution_count": 78,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -4335,7 +4335,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 79,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -4361,7 +4361,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 32, "execution_count": 80,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -4385,7 +4385,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 33, "execution_count": 81,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -4416,7 +4416,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 34, "execution_count": 82,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -4433,7 +4433,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 35, "execution_count": 83,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -4468,7 +4468,7 @@
"Name: Gemeente, dtype: int64" "Name: Gemeente, dtype: int64"
] ]
}, },
"execution_count": 35, "execution_count": 83,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -4486,7 +4486,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 56, "execution_count": 84,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -4509,7 +4509,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 37, "execution_count": 85,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -4813,7 +4813,7 @@
"[8089 rows x 12 columns]" "[8089 rows x 12 columns]"
] ]
}, },
"execution_count": 37, "execution_count": 85,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -4830,7 +4830,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 38, "execution_count": 86,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5134,7 +5134,7 @@
"[8089 rows x 12 columns]" "[8089 rows x 12 columns]"
] ]
}, },
"execution_count": 38, "execution_count": 86,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -5146,7 +5146,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 39, "execution_count": 87,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -5246,7 +5246,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 40, "execution_count": 88,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -5261,7 +5261,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 41, "execution_count": 89,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -5271,7 +5271,79 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 85, "execution_count": 122,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Gemeente Naam stembureau dist gemeentecode \\\n",
"68130 Vlieland Sporthal Flidunen 8023.806656 GM0096 \n",
"\n",
" geometry gemeente Kiesgerechtigde bevolking \\\n",
"68130 POINT (127250.000 586750.000) Vlieland 1 \n",
"\n",
" binned \n",
"68130 1; 0-10.000 stemgerechtigden \n",
" Gemeente Naam stembureau dist gemeentecode \\\n",
"62349 Zeewolde Panta Rhei 9173.600947 GM0050 \n",
"\n",
" geometry gemeente Kiesgerechtigde bevolking \\\n",
"62349 POINT (159750.000 491750.000) Zeewolde 18.3 \n",
"\n",
" binned \n",
"62349 2; 10.000-30.000 stemgerechtigden \n",
" Gemeente Naam stembureau dist gemeentecode \\\n",
"28821 Harderwijk Drive-In op parkeerplaats P2 8167.139659 GM0243 \n",
"\n",
" geometry gemeente Kiesgerechtigde bevolking \\\n",
"28821 POINT (167250.000 492250.000) Harderwijk 38 \n",
"\n",
" binned \n",
"28821 3; 30.000-60.000 stemgerechtigden \n",
" Gemeente Naam stembureau dist \\\n",
"20280 Lelystad Voormalige Scholengemeenschap De Rietlanden 9028.79007 \n",
"\n",
" gemeentecode geometry gemeente \\\n",
"20280 GM0995 POINT (159250.000 492250.000) Lelystad \n",
"\n",
" Kiesgerechtigde bevolking binned \n",
"20280 62.9 4; 60.000-100.000 stemgerechtigden \n",
" Gemeente Naam stembureau dist gemeentecode \\\n",
"22807 Almere Buurthuis De Cartoon 7706.818285 GM0034 \n",
"\n",
" geometry gemeente Kiesgerechtigde bevolking \\\n",
"22807 POINT (157750.000 490250.000) Almere 164 \n",
"\n",
" binned \n",
"22807 5; 100.000-350.000 stemgerechtigden \n",
" Gemeente Naam stembureau dist gemeentecode \\\n",
"11552 Rotterdam Dorpskerk 5983.140982 GM0599 \n",
"\n",
" geometry gemeente Kiesgerechtigde bevolking \\\n",
"11552 POINT (66750.000 438250.000) Rotterdam 516.8 \n",
"\n",
" binned \n",
"11552 6; >350.000 stemgerechtigden \n"
]
}
],
"source": [
"df_dist_nonbin = df_nearest[['Gemeente', 'Naam stembureau', 'dist', \"CBS gemeentecode\", \"geometry\"]].rename(columns = {'CBS gemeentecode': 'gemeentecode'})\n",
"df_dist_bin = pd.merge(df_dist_nonbin, df_stemger_clean, on = 'gemeentecode')\n",
"\n",
"df_furthest_binned = pd.DataFrame()\n",
"\n",
"for label in labels: \n",
" print(df_dist_bin[df_dist_bin['binned'].str.fullmatch(label)].sort_values(by=['dist'])[::-1].head(1))\n",
" df_furthest_binned = df_furthest_binned.append(df_dist_bin[df_dist_bin['binned'].str.fullmatch(label)].sort_values(by=['dist'])[::-1].head(1))\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 90,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5347,7 +5419,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 99, "execution_count": 91,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5356,7 +5428,7 @@
"[Text(0, 0, '14 maart'), Text(1, 0, '15 maart'), Text(2, 0, '16 maart')]" "[Text(0, 0, '14 maart'), Text(1, 0, '15 maart'), Text(2, 0, '16 maart')]"
] ]
}, },
"execution_count": 99, "execution_count": 91,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
}, },
@ -5407,7 +5479,199 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 42, "execution_count": 123,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead tr th {\n",
" text-align: left;\n",
" }\n",
"\n",
" .dataframe thead tr:last-of-type th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr>\n",
" <th></th>\n",
" <th colspan=\"12\" halign=\"left\">aantal</th>\n",
" </tr>\n",
" <tr>\n",
" <th>staffel</th>\n",
" <th colspan=\"2\" halign=\"left\">1; 0-10.000 stemgerechtigden</th>\n",
" <th colspan=\"2\" halign=\"left\">2; 10.000-30.000 stemgerechtigden</th>\n",
" <th colspan=\"2\" halign=\"left\">3; 30.000-60.000 stemgerechtigden</th>\n",
" <th colspan=\"2\" halign=\"left\">4; 60.000-100.000 stemgerechtigden</th>\n",
" <th colspan=\"2\" halign=\"left\">5; 100.000-350.000 stemgerechtigden</th>\n",
" <th colspan=\"2\" halign=\"left\">6; &gt;350.000 stemgerechtigden</th>\n",
" </tr>\n",
" <tr>\n",
" <th>standaard</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" <th>True</th>\n",
" <th>False</th>\n",
" </tr>\n",
" <tr>\n",
" <th>dag</th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>14 maart</th>\n",
" <td>28</td>\n",
" <td>0</td>\n",
" <td>421</td>\n",
" <td>15</td>\n",
" <td>346</td>\n",
" <td>11</td>\n",
" <td>177</td>\n",
" <td>3</td>\n",
" <td>197</td>\n",
" <td>13</td>\n",
" <td>151</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15 maart</th>\n",
" <td>29</td>\n",
" <td>4</td>\n",
" <td>427</td>\n",
" <td>16</td>\n",
" <td>347</td>\n",
" <td>16</td>\n",
" <td>182</td>\n",
" <td>1</td>\n",
" <td>192</td>\n",
" <td>15</td>\n",
" <td>151</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16 maart</th>\n",
" <td>126</td>\n",
" <td>3</td>\n",
" <td>2150</td>\n",
" <td>101</td>\n",
" <td>2196</td>\n",
" <td>65</td>\n",
" <td>950</td>\n",
" <td>27</td>\n",
" <td>1361</td>\n",
" <td>37</td>\n",
" <td>1010</td>\n",
" <td>5</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" aantal \\\n",
"staffel 1; 0-10.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 28 0 \n",
"15 maart 29 4 \n",
"16 maart 126 3 \n",
"\n",
" \\\n",
"staffel 2; 10.000-30.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 421 15 \n",
"15 maart 427 16 \n",
"16 maart 2150 101 \n",
"\n",
" \\\n",
"staffel 3; 30.000-60.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 346 11 \n",
"15 maart 347 16 \n",
"16 maart 2196 65 \n",
"\n",
" \\\n",
"staffel 4; 60.000-100.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 177 3 \n",
"15 maart 182 1 \n",
"16 maart 950 27 \n",
"\n",
" \\\n",
"staffel 5; 100.000-350.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 197 13 \n",
"15 maart 192 15 \n",
"16 maart 1361 37 \n",
"\n",
" \n",
"staffel 6; >350.000 stemgerechtigden \n",
"standaard True False \n",
"dag \n",
"14 maart 151 1 \n",
"15 maart 151 1 \n",
"16 maart 1010 5 "
]
},
"execution_count": 123,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_open_standaard_full.pivot(index='dag', columns=['staffel', 'standaard'], values=['aantal'])\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Staffel 1 2 3 4 5 6 \n",
"14 maart 0% 3.4% 3.1% 1.7% 6.2% 0.7%\n",
"15 maart 12.1% 3.6% 4.4% 0.5% 7.2% 0.7%\n",
"16 maart 2.3% 4.5% 2.9% 2.8% 2.6% 0.5%"
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": { "metadata": {
"scrolled": false "scrolled": false
}, },
@ -5626,7 +5890,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 43, "execution_count": 93,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -5636,7 +5900,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 44, "execution_count": 94,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -5662,7 +5926,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 45, "execution_count": 95,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5684,7 +5948,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 46, "execution_count": 96,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5705,7 +5969,7 @@
"\u001b[0;31mInvalidComparison\u001b[0m: 2022-03-14 07:30:00+00:00", "\u001b[0;31mInvalidComparison\u001b[0m: 2022-03-14 07:30:00+00:00",
"\nDuring handling of the above exception, another exception occurred:\n", "\nDuring handling of the above exception, another exception occurred:\n",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb Cell 65'\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=0'>1</a>\u001b[0m filtered_datestack_1 \u001b[39m=\u001b[39m wims_datestack_grouped\u001b[39m.\u001b[39mloc[(pd\u001b[39m.\u001b[39;49mto_datetime(wims_datestack_grouped[\u001b[39m'\u001b[39;49m\u001b[39mOpeningstijden\u001b[39;49m\u001b[39m'\u001b[39;49m]) \u001b[39m>\u001b[39;49m\u001b[39m=\u001b[39;49m pd\u001b[39m.\u001b[39;49mto_datetime(\u001b[39m'\u001b[39;49m\u001b[39m2022-03-14T07:30:00.000Z\u001b[39;49m\u001b[39m'\u001b[39;49m))\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=1'>2</a>\u001b[0m \u001b[39m&\u001b[39m (pd\u001b[39m.\u001b[39mto_datetime(wims_datestack_grouped[\u001b[39m'\u001b[39m\u001b[39mOpeningstijden\u001b[39m\u001b[39m'\u001b[39m]) \u001b[39m<\u001b[39m\u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mto_datetime(\u001b[39m'\u001b[39m\u001b[39m2022-03-14T21:00:00.000Z\u001b[39m\u001b[39m'\u001b[39m))]\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=2'>3</a>\u001b[0m graph_open_stacked(filtered_datestack_1)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=3'>4</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=4'>5</a>\u001b[0m \u001b[39mfiltered_datestack_2 = wims_datestack_grouped.loc[(pd.to_datetime(((wims_datestack_grouped['Openingstijden'])) >= pd.to_datetime('2022-03-15T07:30:00.000Z')))\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=5'>6</a>\u001b[0m \u001b[39m & (pd.to_datetime(wims_datestack_grouped['Openingstijden']) <= pd.to_datetime('2022-03-15T21:00:00.000Z'))]\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=9'>10</a>\u001b[0m \u001b[39mgraph_open_stacked(filtered_datestack_3)\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000063?line=10'>11</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n", "\u001b[1;32m/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb Cell 66'\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=0'>1</a>\u001b[0m filtered_datestack_1 \u001b[39m=\u001b[39m wims_datestack_grouped\u001b[39m.\u001b[39mloc[(pd\u001b[39m.\u001b[39;49mto_datetime(wims_datestack_grouped[\u001b[39m'\u001b[39;49m\u001b[39mOpeningstijden\u001b[39;49m\u001b[39m'\u001b[39;49m]) \u001b[39m>\u001b[39;49m\u001b[39m=\u001b[39;49m pd\u001b[39m.\u001b[39;49mto_datetime(\u001b[39m'\u001b[39;49m\u001b[39m2022-03-14T07:30:00.000Z\u001b[39;49m\u001b[39m'\u001b[39;49m))\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=1'>2</a>\u001b[0m \u001b[39m&\u001b[39m (pd\u001b[39m.\u001b[39mto_datetime(wims_datestack_grouped[\u001b[39m'\u001b[39m\u001b[39mOpeningstijden\u001b[39m\u001b[39m'\u001b[39m]) \u001b[39m<\u001b[39m\u001b[39m=\u001b[39m pd\u001b[39m.\u001b[39mto_datetime(\u001b[39m'\u001b[39m\u001b[39m2022-03-14T21:00:00.000Z\u001b[39m\u001b[39m'\u001b[39m))]\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=2'>3</a>\u001b[0m graph_open_stacked(filtered_datestack_1)\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=3'>4</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=4'>5</a>\u001b[0m \u001b[39mfiltered_datestack_2 = wims_datestack_grouped.loc[(pd.to_datetime(((wims_datestack_grouped['Openingstijden'])) >= pd.to_datetime('2022-03-15T07:30:00.000Z')))\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=5'>6</a>\u001b[0m \u001b[39m & (pd.to_datetime(wims_datestack_grouped['Openingstijden']) <= pd.to_datetime('2022-03-15T21:00:00.000Z'))]\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=9'>10</a>\u001b[0m \u001b[39mgraph_open_stacked(filtered_datestack_3)\u001b[39;00m\n\u001b[1;32m <a href='vscode-notebook-cell:/home/lillian/Code/stembureau-meting/jupyter/stembureau_data.ipynb#ch0000065?line=10'>11</a>\u001b[0m \u001b[39m\"\"\"\u001b[39;00m\n",
"File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py:70\u001b[0m, in \u001b[0;36m_unpack_zerodim_and_defer.<locals>.new_method\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=65'>66</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mNotImplemented\u001b[39m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=67'>68</a>\u001b[0m other \u001b[39m=\u001b[39m item_from_zerodim(other)\n\u001b[0;32m---> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=69'>70</a>\u001b[0m \u001b[39mreturn\u001b[39;00m method(\u001b[39mself\u001b[39;49m, other)\n", "File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py:70\u001b[0m, in \u001b[0;36m_unpack_zerodim_and_defer.<locals>.new_method\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=65'>66</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mNotImplemented\u001b[39m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=67'>68</a>\u001b[0m other \u001b[39m=\u001b[39m item_from_zerodim(other)\n\u001b[0;32m---> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/ops/common.py?line=69'>70</a>\u001b[0m \u001b[39mreturn\u001b[39;00m method(\u001b[39mself\u001b[39;49m, other)\n",
"File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py:60\u001b[0m, in \u001b[0;36mOpsMixin.__ge__\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=57'>58</a>\u001b[0m \u001b[39m@unpack_zerodim_and_defer\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39m__ge__\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=58'>59</a>\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__ge__\u001b[39m(\u001b[39mself\u001b[39m, other):\n\u001b[0;32m---> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=59'>60</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_cmp_method(other, operator\u001b[39m.\u001b[39;49mge)\n", "File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py:60\u001b[0m, in \u001b[0;36mOpsMixin.__ge__\u001b[0;34m(self, other)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=57'>58</a>\u001b[0m \u001b[39m@unpack_zerodim_and_defer\u001b[39m(\u001b[39m\"\u001b[39m\u001b[39m__ge__\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=58'>59</a>\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m__ge__\u001b[39m(\u001b[39mself\u001b[39m, other):\n\u001b[0;32m---> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/arraylike.py?line=59'>60</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_cmp_method(other, operator\u001b[39m.\u001b[39;49mge)\n",
"File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py:5623\u001b[0m, in \u001b[0;36mSeries._cmp_method\u001b[0;34m(self, other, op)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5619'>5620</a>\u001b[0m rvalues \u001b[39m=\u001b[39m extract_array(other, extract_numpy\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m, extract_range\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5621'>5622</a>\u001b[0m \u001b[39mwith\u001b[39;00m np\u001b[39m.\u001b[39merrstate(\u001b[39mall\u001b[39m\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mignore\u001b[39m\u001b[39m\"\u001b[39m):\n\u001b[0;32m-> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5622'>5623</a>\u001b[0m res_values \u001b[39m=\u001b[39m ops\u001b[39m.\u001b[39;49mcomparison_op(lvalues, rvalues, op)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5624'>5625</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_construct_result(res_values, name\u001b[39m=\u001b[39mres_name)\n", "File \u001b[0;32m~/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py:5623\u001b[0m, in \u001b[0;36mSeries._cmp_method\u001b[0;34m(self, other, op)\u001b[0m\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5619'>5620</a>\u001b[0m rvalues \u001b[39m=\u001b[39m extract_array(other, extract_numpy\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m, extract_range\u001b[39m=\u001b[39m\u001b[39mTrue\u001b[39;00m)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5621'>5622</a>\u001b[0m \u001b[39mwith\u001b[39;00m np\u001b[39m.\u001b[39merrstate(\u001b[39mall\u001b[39m\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39mignore\u001b[39m\u001b[39m\"\u001b[39m):\n\u001b[0;32m-> <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5622'>5623</a>\u001b[0m res_values \u001b[39m=\u001b[39m ops\u001b[39m.\u001b[39;49mcomparison_op(lvalues, rvalues, op)\n\u001b[1;32m <a href='file:///home/lillian/.conda/envs/stembureaus/lib/python3.10/site-packages/pandas/core/series.py?line=5624'>5625</a>\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_construct_result(res_values, name\u001b[39m=\u001b[39mres_name)\n",
@ -5741,7 +6005,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 60, "execution_count": 97,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5908,7 +6172,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 61, "execution_count": 98,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5953,7 +6217,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 62, "execution_count": 99,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -5994,7 +6258,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 63, "execution_count": 100,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6017,7 +6281,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 64, "execution_count": 101,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6231,7 +6495,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 65, "execution_count": 102,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6255,7 +6519,7 @@
"dtype: float64" "dtype: float64"
] ]
}, },
"execution_count": 65, "execution_count": 102,
"metadata": {}, "metadata": {},
"output_type": "execute_result" "output_type": "execute_result"
} }
@ -6275,7 +6539,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 66, "execution_count": 103,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6308,7 +6572,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 67, "execution_count": 104,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -6319,7 +6583,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 68, "execution_count": 105,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6362,7 +6626,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 69, "execution_count": 106,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -6378,7 +6642,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 70, "execution_count": 107,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6459,7 +6723,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 71, "execution_count": 108,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -6481,7 +6745,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 72, "execution_count": 109,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
@ -6492,7 +6756,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 73, "execution_count": 110,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6587,7 +6851,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 74, "execution_count": 111,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6639,7 +6903,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 75, "execution_count": 112,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -6720,7 +6984,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 76, "execution_count": 113,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [