diff --git a/.gitignore b/.gitignore
index 8ba3189c176..3b9471615e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
src/VAERS/
src/intensivstationen/zeitreihe-tagesdaten.csv
src/intensivstationen/geckodriver.log
-src/intensivstationen/Intensivstationen.nbconvert.ipynb
src/intensivstationen/Intensivstationen.nbconvert.html
.ipynb_checkpoints/
.history/
diff --git a/src/intensivstationen/Intensivstationen.ipynb b/src/intensivstationen/Intensivstationen.ipynb
index 44d562c7c04..92ce6e0bd0c 100644
--- a/src/intensivstationen/Intensivstationen.ipynb
+++ b/src/intensivstationen/Intensivstationen.ipynb
@@ -153,38 +153,6 @@
" dateStart=timeSeries['date'].min(),\n",
" dateEnd=timeSeries['date'].max()))"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "0218cdb4",
- "metadata": {},
- "outputs": [],
- "source": [
- "def publishGitHubPages():\n",
- " %cd /home/frankknoll/Dokumente/Corona/projects/HowBadIsMyBatch-pages\n",
- " ! git add -A\n",
- " ! git commit -m \"updating data for Intensivstationen\"\n",
- " ! git push"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "a1e83b07",
- "metadata": {},
- "source": [
- "### see https://knollfrank.github.io/HowBadIsMyBatch/intensivstationen.html"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "5f173c2b",
- "metadata": {},
- "outputs": [],
- "source": [
- "publishGitHubPages()"
- ]
}
],
"metadata": {
diff --git a/src/intensivstationen/Intensivstationen.nbconvert.ipynb b/src/intensivstationen/Intensivstationen.nbconvert.ipynb
new file mode 100644
index 00000000000..e3e53fe870d
--- /dev/null
+++ b/src/intensivstationen/Intensivstationen.nbconvert.ipynb
@@ -0,0 +1,5401 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "9de5907f-18f5-4cb1-903e-26028ff1fa03",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:15.922037Z",
+ "iopub.status.busy": "2022-12-05T13:33:15.921181Z",
+ "iopub.status.idle": "2022-12-05T13:33:16.274097Z",
+ "shell.execute_reply": "2022-12-05T13:33:16.273561Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "from urllib import request\n",
+ "\n",
+ "pd.set_option('display.max_rows', 100)\n",
+ "pd.set_option('display.max_columns', None)\n",
+ "pd.set_option('mode.chained_assignment', 'raise')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "e40d4c8d",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:16.277294Z",
+ "iopub.status.busy": "2022-12-05T13:33:16.276717Z",
+ "iopub.status.idle": "2022-12-05T13:33:16.280833Z",
+ "shell.execute_reply": "2022-12-05T13:33:16.280184Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "05.12.2022, 14:33:16 Uhr\n"
+ ]
+ }
+ ],
+ "source": [
+ "from datetime import datetime\n",
+ "\n",
+ "print(datetime.now().strftime(\"%d.%m.%Y, %H:%M:%S Uhr\"))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "579c0911",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:16.284148Z",
+ "iopub.status.busy": "2022-12-05T13:33:16.283939Z",
+ "iopub.status.idle": "2022-12-05T13:33:16.989074Z",
+ "shell.execute_reply": "2022-12-05T13:33:16.986448Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "/home/frankknoll/Dokumente/Corona/projects/HowBadIsMyBatch/src/intensivstationen\r\n"
+ ]
+ }
+ ],
+ "source": [
+ "! pwd"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "dfa836ec",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:16.999683Z",
+ "iopub.status.busy": "2022-12-05T13:33:16.998858Z",
+ "iopub.status.idle": "2022-12-05T13:33:17.009146Z",
+ "shell.execute_reply": "2022-12-05T13:33:17.007377Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "needsUpdate = False"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "79de4057",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:17.019274Z",
+ "iopub.status.busy": "2022-12-05T13:33:17.017784Z",
+ "iopub.status.idle": "2022-12-05T13:33:17.166150Z",
+ "shell.execute_reply": "2022-12-05T13:33:17.165518Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from bs4 import BeautifulSoup\n",
+ "import requests\n",
+ "from datetime import datetime\n",
+ "from time import sleep\n",
+ "from selenium import webdriver\n",
+ "from selenium.webdriver.firefox.options import Options\n",
+ "\n",
+ "class DateProvider:\n",
+ " \n",
+ " INTENSIVSTATIONEN_DATE_FORMAT = \"%d.%m.%Y, %H:%M Uhr\"\n",
+ "\n",
+ " def __init__(self):\n",
+ " self.lastUpdated = None\n",
+ " self.lastUpdatedDataSource = None\n",
+ "\n",
+ " def needsUpdate(self):\n",
+ " return self.getLastUpdated() < self.getLastUpdatedDataSource()\n",
+ " \n",
+ " def getLastUpdated(self):\n",
+ " if self.lastUpdated is None:\n",
+ " htmlContent = requests.get(\"https://knollfrank.github.io/HowBadIsMyBatch/intensivstationen.html\").text\n",
+ " soup = BeautifulSoup(htmlContent, \"lxml\")\n",
+ " dateStr = soup.find(id = \"Datenstand\").text\n",
+ " self.lastUpdated = datetime.strptime(dateStr, DateProvider.INTENSIVSTATIONEN_DATE_FORMAT)\n",
+ " \n",
+ " return self.lastUpdated\n",
+ "\n",
+ " def getLastUpdatedDataSource(self):\n",
+ " if self.lastUpdatedDataSource is None:\n",
+ " html = self._getOriginalHtml()\n",
+ " lastUpdatedColumn = 'Letzte Änderung'\n",
+ " dataFrame = self._asDataFrame(html, lastUpdatedColumn)\n",
+ " self.lastUpdatedDataSource = dataFrame.loc['Landkreis-Daten', lastUpdatedColumn].to_pydatetime()\n",
+ "\n",
+ " return self.lastUpdatedDataSource\n",
+ "\n",
+ " def _getOriginalHtml(self):\n",
+ " options = Options()\n",
+ " options.headless = True\n",
+ " options.add_argument(\"-profile\")\n",
+ " # put the root directory your default profile path here, you can check it by opening Firefox and then pasting 'about:profiles' into the url field \n",
+ " options.add_argument(\"/home/frankknoll/snap/firefox/common/.mozilla/firefox/1j6r2yp6.default\")\n",
+ " driver = webdriver.Firefox(options = options)\n",
+ " driver.get('https://www.intensivregister.de/#/aktuelle-lage/downloads')\n",
+ " sleep(10)\n",
+ " innerHTML = driver.execute_script(\"return document.body.innerHTML\")\n",
+ " driver.quit()\n",
+ " return innerHTML\n",
+ "\n",
+ " def _asDataFrame(self, html, lastUpdatedColumn):\n",
+ " dataFrame = pd.read_html(html, parse_dates = [lastUpdatedColumn])[0]\n",
+ " dataFrame[lastUpdatedColumn] = pd.to_datetime(dataFrame[lastUpdatedColumn], format = \"%d.%m.%Y %H:%M Uhr\")\n",
+ " dataFrame.set_index('Name', inplace = True)\n",
+ " return dataFrame\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "336f56e6",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:17.169436Z",
+ "iopub.status.busy": "2022-12-05T13:33:17.168987Z",
+ "iopub.status.idle": "2022-12-05T13:33:31.118196Z",
+ "shell.execute_reply": "2022-12-05T13:33:31.117473Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ " lastUpdated: 2022-11-30 12:49:00\n",
+ "lastUpdatedDataSource: 2022-12-05 12:49:00\n",
+ "needsUpdate: True\n"
+ ]
+ }
+ ],
+ "source": [
+ "dateProvider = DateProvider()\n",
+ "print(' lastUpdated:', dateProvider.getLastUpdated())\n",
+ "print('lastUpdatedDataSource:', dateProvider.getLastUpdatedDataSource()) \n",
+ "needsUpdate = dateProvider.needsUpdate()\n",
+ "print('needsUpdate:', needsUpdate)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "03784154",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:31.121382Z",
+ "iopub.status.busy": "2022-12-05T13:33:31.121151Z",
+ "iopub.status.idle": "2022-12-05T13:33:31.126158Z",
+ "shell.execute_reply": "2022-12-05T13:33:31.125603Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from bs4 import BeautifulSoup\n",
+ "\n",
+ "class HtmlTransformerUtil:\n",
+ " \n",
+ " def applySoupTransformerToFile(self, file, soupTransformer):\n",
+ " self._writeSoup(soupTransformer(self._readSoup(file)), file)\n",
+ "\n",
+ " def _readSoup(self, file):\n",
+ " with open(file) as fp:\n",
+ " soup = BeautifulSoup(fp, 'lxml')\n",
+ " return soup\n",
+ "\n",
+ " def _writeSoup(self, soup, file):\n",
+ " with open(file, \"w\") as fp:\n",
+ " fp.write(str(soup)) \n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "af101279",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:31.128954Z",
+ "iopub.status.busy": "2022-12-05T13:33:31.128733Z",
+ "iopub.status.idle": "2022-12-05T13:33:31.132967Z",
+ "shell.execute_reply": "2022-12-05T13:33:31.132243Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def saveLastUpdatedIntensivstationen(lastUpdated):\n",
+ " def setLastUpdated(soup):\n",
+ " soup.find(id = \"Datenstand\").string.replace_with(lastUpdated.strftime(DateProvider.INTENSIVSTATIONEN_DATE_FORMAT))\n",
+ " return soup\n",
+ "\n",
+ " HtmlTransformerUtil().applySoupTransformerToFile(\n",
+ " file = \"../../docs/intensivstationen.html\",\n",
+ " soupTransformer = setLastUpdated)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "63be303c",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:31.136146Z",
+ "iopub.status.busy": "2022-12-05T13:33:31.135871Z",
+ "iopub.status.idle": "2022-12-05T13:33:31.165780Z",
+ "shell.execute_reply": "2022-12-05T13:33:31.165247Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "saveLastUpdatedIntensivstationen(dateProvider.getLastUpdatedDataSource())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "d021de84",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:31.168581Z",
+ "iopub.status.busy": "2022-12-05T13:33:31.168238Z",
+ "iopub.status.idle": "2022-12-05T13:33:31.226680Z",
+ "shell.execute_reply": "2022-12-05T13:33:31.225887Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def readTimeseries(download = False):\n",
+ " timeSeriesFile = 'zeitreihe-tagesdaten.csv'\n",
+ " if download:\n",
+ " _downloadTimeseries(timeSeriesFile)\n",
+ "\n",
+ " timeseries = pd.read_csv(\n",
+ " timeSeriesFile,\n",
+ " low_memory = False,\n",
+ " usecols = ['date', 'bundesland', 'gemeindeschluessel', 'betten_belegt', 'betten_frei'],\n",
+ " parse_dates = ['date'],\n",
+ " date_parser = lambda dateStr: pd.to_datetime(dateStr, format = \"%Y-%m-%d\"),\n",
+ " dtype = {\n",
+ " 'gemeindeschluessel': 'string',\n",
+ " 'bundesland': 'string'\n",
+ " })\n",
+ " return timeseries.sort_values(by = 'date', ascending = True)\n",
+ "\n",
+ "# download https://diviexchange.blob.core.windows.net/%24web/zeitreihe-tagesdaten.csv or https://www.intensivregister.de/#/aktuelle-lage/downloads\n",
+ "def _downloadTimeseries(timeSeriesFile):\n",
+ " request.urlretrieve(\n",
+ " 'https://diviexchange.blob.core.windows.net/%24web/zeitreihe-tagesdaten.csv',\n",
+ " timeSeriesFile)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "id": "3f992231",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:33:31.230684Z",
+ "iopub.status.busy": "2022-12-05T13:33:31.230285Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.278366Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.277732Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " date \n",
+ " bundesland \n",
+ " gemeindeschluessel \n",
+ " betten_frei \n",
+ " betten_belegt \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 \n",
+ " 2020-04-24 \n",
+ " 01 \n",
+ " 01001 \n",
+ " 40 \n",
+ " 38 \n",
+ " \n",
+ " \n",
+ " 267 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09471 \n",
+ " 9 \n",
+ " 9 \n",
+ " \n",
+ " \n",
+ " 266 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09464 \n",
+ " 17 \n",
+ " 23 \n",
+ " \n",
+ " \n",
+ " 265 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09463 \n",
+ " 9 \n",
+ " 25 \n",
+ " \n",
+ " \n",
+ " 264 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09462 \n",
+ " 12 \n",
+ " 51 \n",
+ " \n",
+ " \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " \n",
+ " \n",
+ " 378119 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06437 \n",
+ " 4 \n",
+ " 122 \n",
+ " \n",
+ " \n",
+ " 378118 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06436 \n",
+ " 0 \n",
+ " 19 \n",
+ " \n",
+ " \n",
+ " 378117 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06435 \n",
+ " 9 \n",
+ " 64 \n",
+ " \n",
+ " \n",
+ " 378115 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06433 \n",
+ " 1 \n",
+ " 18 \n",
+ " \n",
+ " \n",
+ " 378388 \n",
+ " 2022-12-05 \n",
+ " 16 \n",
+ " 16077 \n",
+ " 4 \n",
+ " 24 \n",
+ " \n",
+ " \n",
+ "
\n",
+ "
378389 rows × 5 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " date bundesland gemeindeschluessel betten_frei betten_belegt\n",
+ "0 2020-04-24 01 01001 40 38\n",
+ "267 2020-04-24 09 09471 9 9\n",
+ "266 2020-04-24 09 09464 17 23\n",
+ "265 2020-04-24 09 09463 9 25\n",
+ "264 2020-04-24 09 09462 12 51\n",
+ "... ... ... ... ... ...\n",
+ "378119 2022-12-05 06 06437 4 122\n",
+ "378118 2022-12-05 06 06436 0 19\n",
+ "378117 2022-12-05 06 06435 9 64\n",
+ "378115 2022-12-05 06 06433 1 18\n",
+ "378388 2022-12-05 16 16077 4 24\n",
+ "\n",
+ "[378389 rows x 5 columns]"
+ ]
+ },
+ "execution_count": 11,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "timeSeries = readTimeseries(download = needsUpdate)\n",
+ "timeSeries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 12,
+ "id": "2d34c6a4",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.281179Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.280897Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.287034Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.286323Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def readKreise(download = False):\n",
+ " kreiseFile = '04-kreise.xlsx'\n",
+ " if download:\n",
+ " _downloadKreise(kreiseFile)\n",
+ " \n",
+ " kreise = pd.read_excel(\n",
+ " kreiseFile,\n",
+ " sheet_name = 'Kreisfreie Städte u. Landkreise',\n",
+ " header = 5,\n",
+ " index_col = 0)\n",
+ " kreise = kreise.rename(columns = {'2': 'Bundesland', 3: 'Kreis', 6: 'Einwohnerzahl'})[['Bundesland', 'Kreis', 'Einwohnerzahl']]\n",
+ " kreise.index.set_names(\"Key\", inplace = True)\n",
+ " return kreise\n",
+ "\n",
+ "# download https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.xlsx?__blob=publicationFile or https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.html\n",
+ "def _downloadKreise(kreiseFile):\n",
+ " request.urlretrieve(\n",
+ " 'https://www.destatis.de/DE/Themen/Laender-Regionen/Regionales/Gemeindeverzeichnis/Administrativ/04-kreise.xlsx?__blob=publicationFile',\n",
+ " kreiseFile)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "74ea4d55",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.289773Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.289488Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.489906Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.489285Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " Bundesland \n",
+ " Kreis \n",
+ " Einwohnerzahl \n",
+ " \n",
+ " \n",
+ " Key \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " 01 \n",
+ " Schleswig-Holstein \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " 01001 \n",
+ " Kreisfreie Stadt \n",
+ " Flensburg, Stadt \n",
+ " 89934.0 \n",
+ " \n",
+ " \n",
+ " 01002 \n",
+ " Kreisfreie Stadt \n",
+ " Kiel, Landeshauptstadt \n",
+ " 246601.0 \n",
+ " \n",
+ " \n",
+ " 01003 \n",
+ " Kreisfreie Stadt \n",
+ " Lübeck, Hansestadt \n",
+ " 215846.0 \n",
+ " \n",
+ " \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " \n",
+ " \n",
+ " 2) Die Ergebnisse ab Berichtsjahr 2016 sind aufgrund methodischer Änderungen und technischer Weiterentwicklung\\n nur bedingt mit den Vorjahreswerten vegleichbar. Erläuterungen dazu finden Sie unter www.destatis.de beim Bevölkerungsstand. \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " © Daten (im Auftrag der Herausgebergemeinschaft Statistische Ämter des Bundes und der Länder) \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " Statistisches Bundesamt (Destatis), 2021 \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ " Vervielfältigung und Verbreitung, auch auszugsweise, mit Quellenangabe gestattet. \n",
+ " NaN \n",
+ " NaN \n",
+ " NaN \n",
+ " \n",
+ " \n",
+ "
\n",
+ "
488 rows × 3 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Bundesland \\\n",
+ "Key \n",
+ "NaN NaN \n",
+ "01 Schleswig-Holstein \n",
+ "01001 Kreisfreie Stadt \n",
+ "01002 Kreisfreie Stadt \n",
+ "01003 Kreisfreie Stadt \n",
+ "... ... \n",
+ "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n",
+ "NaN NaN \n",
+ "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n",
+ " Statistisches Bundesamt (Destatis), 2021 NaN \n",
+ " Vervielfältigung und Verbreitung, auch aus... NaN \n",
+ "\n",
+ " Kreis \\\n",
+ "Key \n",
+ "NaN NaN \n",
+ "01 NaN \n",
+ "01001 Flensburg, Stadt \n",
+ "01002 Kiel, Landeshauptstadt \n",
+ "01003 Lübeck, Hansestadt \n",
+ "... ... \n",
+ "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n",
+ "NaN NaN \n",
+ "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n",
+ " Statistisches Bundesamt (Destatis), 2021 NaN \n",
+ " Vervielfältigung und Verbreitung, auch aus... NaN \n",
+ "\n",
+ " Einwohnerzahl \n",
+ "Key \n",
+ "NaN NaN \n",
+ "01 NaN \n",
+ "01001 89934.0 \n",
+ "01002 246601.0 \n",
+ "01003 215846.0 \n",
+ "... ... \n",
+ "2) Die Ergebnisse ab Berichtsjahr 2016 sind auf... NaN \n",
+ "NaN NaN \n",
+ "© Daten (im Auftrag der Herausgebergemeinschaft... NaN \n",
+ " Statistisches Bundesamt (Destatis), 2021 NaN \n",
+ " Vervielfältigung und Verbreitung, auch aus... NaN \n",
+ "\n",
+ "[488 rows x 3 columns]"
+ ]
+ },
+ "execution_count": 13,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "kreise = readKreise(download = False)\n",
+ "kreise"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "af96fb11",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.492433Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.492176Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.497263Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.496688Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "class ColumnsAdder:\n",
+ "\n",
+ " def __init__(self, kreise):\n",
+ " self.kreise = kreise\n",
+ "\n",
+ " def addKreisAndBundeslandAndEinwohnerzahlColumns(self, dataFrame):\n",
+ " dataFrame = self.addKreisAndEinwohnerzahlColumns(dataFrame)\n",
+ " return self._addBundeslandColumn(dataFrame)\n",
+ " \n",
+ " def addKreisAndEinwohnerzahlColumns(self, dataFrame):\n",
+ " dataFrame_kreise = pd.merge(dataFrame, self.kreise, how = 'left', left_on = 'gemeindeschluessel', right_index = True)\n",
+ " dataFrame['Kreis'] = dataFrame_kreise['Kreis']\n",
+ " dataFrame['Einwohnerzahl'] = dataFrame_kreise['Einwohnerzahl']\n",
+ " return dataFrame\n",
+ "\n",
+ " def _addBundeslandColumn(self, dataFrame):\n",
+ " return pd.merge(\n",
+ " dataFrame,\n",
+ " self._createBundeslandByKeyTable(),\n",
+ " how = 'left',\n",
+ " left_on = 'bundesland',\n",
+ " right_index = True)\n",
+ "\n",
+ " def _createBundeslandByKeyTable(self):\n",
+ " return self.kreise[self.kreise.index.str.len() == 2][['Bundesland']]\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "id": "62a20115",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.499530Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.499302Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.677385Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.676684Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " date \n",
+ " bundesland \n",
+ " gemeindeschluessel \n",
+ " betten_frei \n",
+ " betten_belegt \n",
+ " Kreis \n",
+ " Einwohnerzahl \n",
+ " Bundesland \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 \n",
+ " 2020-04-24 \n",
+ " 01 \n",
+ " 01001 \n",
+ " 40 \n",
+ " 38 \n",
+ " Flensburg, Stadt \n",
+ " 89934.0 \n",
+ " Schleswig-Holstein \n",
+ " \n",
+ " \n",
+ " 267 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09471 \n",
+ " 9 \n",
+ " 9 \n",
+ " Bamberg \n",
+ " 147497.0 \n",
+ " Bayern \n",
+ " \n",
+ " \n",
+ " 266 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09464 \n",
+ " 17 \n",
+ " 23 \n",
+ " Hof \n",
+ " 45173.0 \n",
+ " Bayern \n",
+ " \n",
+ " \n",
+ " 265 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09463 \n",
+ " 9 \n",
+ " 25 \n",
+ " Coburg \n",
+ " 40842.0 \n",
+ " Bayern \n",
+ " \n",
+ " \n",
+ " 264 \n",
+ " 2020-04-24 \n",
+ " 09 \n",
+ " 09462 \n",
+ " 12 \n",
+ " 51 \n",
+ " Bayreuth \n",
+ " 74048.0 \n",
+ " Bayern \n",
+ " \n",
+ " \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " \n",
+ " \n",
+ " 378119 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06437 \n",
+ " 4 \n",
+ " 122 \n",
+ " Odenwaldkreis \n",
+ " 96754.0 \n",
+ " Hessen \n",
+ " \n",
+ " \n",
+ " 378118 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06436 \n",
+ " 0 \n",
+ " 19 \n",
+ " Main-Taunus-Kreis \n",
+ " 239264.0 \n",
+ " Hessen \n",
+ " \n",
+ " \n",
+ " 378117 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06435 \n",
+ " 9 \n",
+ " 64 \n",
+ " Main-Kinzig-Kreis \n",
+ " 421689.0 \n",
+ " Hessen \n",
+ " \n",
+ " \n",
+ " 378115 \n",
+ " 2022-12-05 \n",
+ " 06 \n",
+ " 06433 \n",
+ " 1 \n",
+ " 18 \n",
+ " Groß-Gerau \n",
+ " 275807.0 \n",
+ " Hessen \n",
+ " \n",
+ " \n",
+ " 378388 \n",
+ " 2022-12-05 \n",
+ " 16 \n",
+ " 16077 \n",
+ " 4 \n",
+ " 24 \n",
+ " Altenburger Land \n",
+ " 88356.0 \n",
+ " Thüringen \n",
+ " \n",
+ " \n",
+ "
\n",
+ "
378389 rows × 8 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " date bundesland gemeindeschluessel betten_frei betten_belegt \\\n",
+ "0 2020-04-24 01 01001 40 38 \n",
+ "267 2020-04-24 09 09471 9 9 \n",
+ "266 2020-04-24 09 09464 17 23 \n",
+ "265 2020-04-24 09 09463 9 25 \n",
+ "264 2020-04-24 09 09462 12 51 \n",
+ "... ... ... ... ... ... \n",
+ "378119 2022-12-05 06 06437 4 122 \n",
+ "378118 2022-12-05 06 06436 0 19 \n",
+ "378117 2022-12-05 06 06435 9 64 \n",
+ "378115 2022-12-05 06 06433 1 18 \n",
+ "378388 2022-12-05 16 16077 4 24 \n",
+ "\n",
+ " Kreis Einwohnerzahl Bundesland \n",
+ "0 Flensburg, Stadt 89934.0 Schleswig-Holstein \n",
+ "267 Bamberg 147497.0 Bayern \n",
+ "266 Hof 45173.0 Bayern \n",
+ "265 Coburg 40842.0 Bayern \n",
+ "264 Bayreuth 74048.0 Bayern \n",
+ "... ... ... ... \n",
+ "378119 Odenwaldkreis 96754.0 Hessen \n",
+ "378118 Main-Taunus-Kreis 239264.0 Hessen \n",
+ "378117 Main-Kinzig-Kreis 421689.0 Hessen \n",
+ "378115 Groß-Gerau 275807.0 Hessen \n",
+ "378388 Altenburger Land 88356.0 Thüringen \n",
+ "\n",
+ "[378389 rows x 8 columns]"
+ ]
+ },
+ "execution_count": 15,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "timeSeries = ColumnsAdder(kreise).addKreisAndBundeslandAndEinwohnerzahlColumns(timeSeries)\n",
+ "timeSeries"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "id": "356494d3",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.680461Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.680231Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.694050Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.693446Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "kreisValues = sorted(timeSeries['Kreis'].drop_duplicates().values)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "id": "05aa0117",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.696889Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.696674Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.700114Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.699571Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def getKreisOptions(kreisValues):\n",
+ " return [getKreisOption(kreis) for kreis in kreisValues]\n",
+ "\n",
+ "def getKreisOption(kreis):\n",
+ " return f'{kreis} '\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "id": "9c38ca16",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.702827Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.702589Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.705946Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.705365Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "kreisOptions = ['Alle Landkreise '] + getKreisOptions(kreisValues)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "id": "9eb453d0",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.708378Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.708108Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.712564Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.712053Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from bs4 import BeautifulSoup\n",
+ "\n",
+ "\n",
+ "class KreisOptionsSetter:\n",
+ "\n",
+ " def setKreisOptions(self, html, options):\n",
+ " soup = self._setKreisOptions(self._parse(html), self._parseOptions(options))\n",
+ " return str(soup)\n",
+ "\n",
+ " def _setKreisOptions(self, soup, options):\n",
+ " kreisSelect = soup.find(id = \"kreisSelect\")\n",
+ " kreisSelect.clear()\n",
+ " for option in options:\n",
+ " kreisSelect.append(option)\n",
+ " return soup\n",
+ "\n",
+ " def _parseOptions(self, options):\n",
+ " return [self._parse(option).option for option in options]\n",
+ "\n",
+ " def _parse(self, html):\n",
+ " return BeautifulSoup(html, 'lxml')\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "id": "29b0930a",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.715615Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.715350Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.722997Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.722368Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "import unittest"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 21,
+ "id": "45072a1d",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.726203Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.725738Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.729594Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.728988Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "class TestHelper:\n",
+ "\n",
+ " @staticmethod\n",
+ " def createDataFrame(index, columns, data, dtypes = {}):\n",
+ " return pd.DataFrame(index = index, columns = columns, data = data).astype(dtypes)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 22,
+ "id": "e4f8fa80",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.732788Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.732533Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.739863Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.739211Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "class KreisOptionsSetterTest(unittest.TestCase):\n",
+ "\n",
+ " def test_setKreisOptions(self):\n",
+ " # Given\n",
+ " kreisOptionsSetter = KreisOptionsSetter()\n",
+ "\n",
+ " # When\n",
+ " htmlActual = kreisOptionsSetter.setKreisOptions(\n",
+ " html='''\n",
+ " \n",
+ " \n",
+ " Test
\n",
+ " \n",
+ " Alle Landkreise \n",
+ " Ahrweiler \n",
+ " Wiesbaden, Landeshauptstadt \n",
+ " Aichach-Friedberg \n",
+ " \n",
+ " \n",
+ " \n",
+ " ''',\n",
+ " options=[\n",
+ " 'Alle Landkreise ',\n",
+ " 'Ahrweiler ',\n",
+ " 'Aichach-Friedberg '])\n",
+ "\n",
+ " # Then\n",
+ " assertEqualHTML(\n",
+ " htmlActual,\n",
+ " '''\n",
+ " \n",
+ " \n",
+ " Test
\n",
+ " \n",
+ " Alle Landkreise \n",
+ " Ahrweiler \n",
+ " Aichach-Friedberg \n",
+ " \n",
+ " \n",
+ " \n",
+ " ''')\n",
+ "\n",
+ "# adapted from https://stackoverflow.com/questions/8006909/pretty-print-assertequal-for-html-strings\n",
+ "def assertEqualHTML(string1, string2, file1='', file2=''):\n",
+ " u'''\n",
+ " Compare two unicode strings containing HTML.\n",
+ " A human friendly diff goes to logging.error() if they\n",
+ " are not equal, and an exception gets raised.\n",
+ " '''\n",
+ " from bs4 import BeautifulSoup as bs\n",
+ " import difflib\n",
+ "\n",
+ " def short(mystr):\n",
+ " max = 20\n",
+ " if len(mystr) > max:\n",
+ " return mystr[:max]\n",
+ " return mystr\n",
+ " p = []\n",
+ " for mystr, file in [(string1, file1), (string2, file2)]:\n",
+ " if not isinstance(mystr, str):\n",
+ " raise Exception(u'string ist not unicode: %r %s' %\n",
+ " (short(mystr), file))\n",
+ " soup = bs(mystr)\n",
+ " pretty = soup.prettify()\n",
+ " p.append(pretty)\n",
+ " if p[0] != p[1]:\n",
+ " for line in difflib.unified_diff(p[0].splitlines(), p[1].splitlines(), fromfile=file1, tofile=file2):\n",
+ " display(line)\n",
+ " display(p[0], ' != ', p[1])\n",
+ " raise Exception('Not equal %s %s' % (file1, file2))\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 23,
+ "id": "403f8b7b",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.742169Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.741967Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.747093Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.746418Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from bs4 import BeautifulSoup\n",
+ "\n",
+ "\n",
+ "def saveKreisOptions(kreisOptions):\n",
+ " HtmlTransformerUtil().applySoupTransformerToFile(\n",
+ " file = \"../../docs/intensivstationen.html\",\n",
+ " soupTransformer =\n",
+ " lambda soup:\n",
+ " BeautifulSoup(\n",
+ " KreisOptionsSetter().setKreisOptions(html = str(soup), options = kreisOptions),\n",
+ " 'lxml'))\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 24,
+ "id": "5dd8d864",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.750413Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.750007Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.881791Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.881263Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "saveKreisOptions(kreisOptions)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 25,
+ "id": "43c2f826",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.884901Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.884619Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.889692Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.889202Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "import json\n",
+ "\n",
+ "\n",
+ "class IOUtils:\n",
+ "\n",
+ " def saveDictAsJson(dict, file):\n",
+ " IOUtils.ensurePath(file)\n",
+ " with open(file, 'w') as outfile:\n",
+ " json.dump(dict, outfile)\n",
+ "\n",
+ " @staticmethod\n",
+ " def ensurePath(file):\n",
+ " directory = os.path.dirname(file)\n",
+ " if not os.path.exists(directory):\n",
+ " os.makedirs(directory)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "id": "997a4bdb",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.892139Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.891892Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.897733Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.897193Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def getIntensiveCareBeds(timeSeries, kreis = None):\n",
+ " if kreis is not None:\n",
+ " return timeSeries[timeSeries['Kreis'] == kreis][['date', 'betten_belegt', 'betten_frei', 'Einwohnerzahl']]\n",
+ " else:\n",
+ " return timeSeries.groupby('date').agg(**{\n",
+ " 'betten_belegt': pd.NamedAgg(column = 'betten_belegt', aggfunc = 'sum'),\n",
+ " 'betten_frei': pd.NamedAgg(column = 'betten_frei', aggfunc = 'sum'),\n",
+ " 'Einwohnerzahl': pd.NamedAgg(column = 'Einwohnerzahl', aggfunc = 'sum')\n",
+ " }).reset_index()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 27,
+ "id": "a97f5b2b",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.900813Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.900512Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.906789Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.906125Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def getAndPersistIntensiveCareBeds(timeSeries, kreis = None):\n",
+ " intensiveCareBeds = getIntensiveCareBeds(timeSeries, kreis)\n",
+ " display(kreis)\n",
+ " _saveAsJson(intensiveCareBeds, _getFilename(kreis))\n",
+ " return intensiveCareBeds\n",
+ "\n",
+ "\n",
+ "def _saveAsJson(intensiveCareBeds, file):\n",
+ " IOUtils.saveDictAsJson(\n",
+ " {\n",
+ " 'population': int(intensiveCareBeds.iloc[0]['Einwohnerzahl']),\n",
+ " 'data': _intensiveCareBeds2Dict(intensiveCareBeds),\n",
+ " },\n",
+ " file)\n",
+ "\n",
+ "\n",
+ "def _intensiveCareBeds2Dict(intensiveCareBeds):\n",
+ " df = intensiveCareBeds[['date', 'betten_belegt', 'betten_frei']].copy()\n",
+ " df['date'] = df['date'].dt.strftime('%Y-%m-%d')\n",
+ " return df.to_dict(orient = \"records\")\n",
+ "\n",
+ "\n",
+ "def _getFilename(kreis):\n",
+ " return f'../../docs/data/intensivstationen/intensivstationen-{_getSuffix(kreis)}.json'\n",
+ "\n",
+ "\n",
+ "def _getSuffix(kreis):\n",
+ " return kreis if kreis is not None else 'de'\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 28,
+ "id": "349edd73",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.909788Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.909329Z",
+ "iopub.status.idle": "2022-12-05T13:34:23.948250Z",
+ "shell.execute_reply": "2022-12-05T13:34:23.947596Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "None"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " date \n",
+ " betten_belegt \n",
+ " betten_frei \n",
+ " Einwohnerzahl \n",
+ " \n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 \n",
+ " 2020-04-24 \n",
+ " 19237 \n",
+ " 12270 \n",
+ " 82401553.0 \n",
+ " \n",
+ " \n",
+ " 1 \n",
+ " 2020-04-25 \n",
+ " 19100 \n",
+ " 12290 \n",
+ " 82401553.0 \n",
+ " \n",
+ " \n",
+ " 2 \n",
+ " 2020-04-26 \n",
+ " 18617 \n",
+ " 12694 \n",
+ " 82401553.0 \n",
+ " \n",
+ " \n",
+ " 3 \n",
+ " 2020-04-27 \n",
+ " 18803 \n",
+ " 12537 \n",
+ " 82360711.0 \n",
+ " \n",
+ " \n",
+ " 4 \n",
+ " 2020-04-28 \n",
+ " 19345 \n",
+ " 12207 \n",
+ " 82504802.0 \n",
+ " \n",
+ " \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " ... \n",
+ " \n",
+ " \n",
+ " 951 \n",
+ " 2022-12-01 \n",
+ " 20513 \n",
+ " 2988 \n",
+ " 82658396.0 \n",
+ " \n",
+ " \n",
+ " 952 \n",
+ " 2022-12-02 \n",
+ " 20501 \n",
+ " 2935 \n",
+ " 82658396.0 \n",
+ " \n",
+ " \n",
+ " 953 \n",
+ " 2022-12-03 \n",
+ " 20189 \n",
+ " 2959 \n",
+ " 82658396.0 \n",
+ " \n",
+ " \n",
+ " 954 \n",
+ " 2022-12-04 \n",
+ " 19955 \n",
+ " 3141 \n",
+ " 82658396.0 \n",
+ " \n",
+ " \n",
+ " 955 \n",
+ " 2022-12-05 \n",
+ " 20141 \n",
+ " 3077 \n",
+ " 82658396.0 \n",
+ " \n",
+ " \n",
+ "
\n",
+ "
956 rows × 4 columns
\n",
+ "
"
+ ],
+ "text/plain": [
+ " date betten_belegt betten_frei Einwohnerzahl\n",
+ "0 2020-04-24 19237 12270 82401553.0\n",
+ "1 2020-04-25 19100 12290 82401553.0\n",
+ "2 2020-04-26 18617 12694 82401553.0\n",
+ "3 2020-04-27 18803 12537 82360711.0\n",
+ "4 2020-04-28 19345 12207 82504802.0\n",
+ ".. ... ... ... ...\n",
+ "951 2022-12-01 20513 2988 82658396.0\n",
+ "952 2022-12-02 20501 2935 82658396.0\n",
+ "953 2022-12-03 20189 2959 82658396.0\n",
+ "954 2022-12-04 19955 3141 82658396.0\n",
+ "955 2022-12-05 20141 3077 82658396.0\n",
+ "\n",
+ "[956 rows x 4 columns]"
+ ]
+ },
+ "execution_count": 28,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "getAndPersistIntensiveCareBeds(timeSeries)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 29,
+ "id": "1b97137f",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:23.951181Z",
+ "iopub.status.busy": "2022-12-05T13:34:23.950846Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.721736Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.721141Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "'Ahrweiler'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Aichach-Friedberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Alb-Donau-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Altenburger Land'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Altenkirchen (Westerwald)'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Altmarkkreis Salzwedel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Altötting'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Alzey-Worms'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Amberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Amberg-Sulzbach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ammerland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Anhalt-Bitterfeld'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ansbach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Aschaffenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Augsburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Aurich'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bad Dürkheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bad Kissingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bad Kreuznach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bad Tölz-Wolfratshausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Baden-Baden, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bamberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Barnim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bautzen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bayreuth'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Berchtesgadener Land'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bergstraße'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Berlin, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bernkastel-Wittlich'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Biberach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bielefeld, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Birkenfeld'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bochum, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bodenseekreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bonn, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Borken'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bottrop, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Brandenburg an der Havel, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Braunschweig, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Breisgau-Hochschwarzwald'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bremen, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Bremerhaven, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Burgenlandkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Böblingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Börde'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Calw'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Celle'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Cham'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Chemnitz, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Cloppenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Coburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Cochem-Zell'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Coesfeld'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Cottbus, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Cuxhaven'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dachau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dahme-Spreewald'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Darmstadt, Wissenschaftsstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Darmstadt-Dieburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Deggendorf'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Delmenhorst, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dessau-Roßlau, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Diepholz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dillingen a.d.Donau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dingolfing-Landau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dithmarschen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Donau-Ries'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Donnersbergkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dortmund, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Dresden, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Duisburg, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Düren'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Düsseldorf, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ebersberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Eichsfeld'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Eichstätt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Eifelkreis Bitburg-Prüm'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Elbe-Elster'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Emden, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Emmendingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Emsland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ennepe-Ruhr-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Enzkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Erding'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Erfurt, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Erlangen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Erlangen-Höchstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Erzgebirgskreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Essen, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Esslingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Euskirchen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Flensburg, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Forchheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Frankenthal (Pfalz), kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Frankfurt (Oder), Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Frankfurt am Main, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Freiburg im Breisgau, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Freising'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Freudenstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Freyung-Grafenau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Friesland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Fulda'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Fürstenfeldbruck'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Fürth'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Garmisch-Partenkirchen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gelsenkirchen, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gera, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Germersheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gießen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gifhorn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Goslar'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gotha'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Grafschaft Bentheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Greiz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Groß-Gerau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Göppingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Görlitz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Göttingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Günzburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Gütersloh'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hagen, Stadt der FernUniversität'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Halle (Saale), Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hamburg, Freie und Hansestadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hameln-Pyrmont'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hamm, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Harburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Harz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Havelland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Haßberge'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heidekreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heidelberg, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heidenheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heilbronn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heilbronn, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Heinsberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Helmstedt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Herford'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Herne, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hersfeld-Rotenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Herzogtum Lauenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hildburghausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hildesheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hochsauerlandkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hochtaunuskreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hof'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Hohenlohekreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Holzminden'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Höxter'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ilm-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ingolstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Jena, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Jerichower Land'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kaiserslautern'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kaiserslautern, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Karlsruhe'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Karlsruhe, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kassel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kassel, documenta-Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kaufbeuren'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kelheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kempten (Allgäu)'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kiel, Landeshauptstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kitzingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kleve'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Koblenz, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Konstanz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Krefeld, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kronach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kulmbach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kusel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Kyffhäuserkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Köln, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lahn-Dill-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Landau in der Pfalz, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Landkreis Rostock'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Landsberg am Lech'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Landshut'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Leer'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Leipzig'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Leipzig, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Leverkusen, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lichtenfels'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Limburg-Weilburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lindau (Bodensee)'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lippe'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ludwigsburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ludwigshafen am Rhein, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ludwigslust-Parchim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lörrach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lübeck, Hansestadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lüchow-Dannenberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Lüneburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Magdeburg, Landeshauptstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Main-Kinzig-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Main-Spessart'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Main-Tauber-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Main-Taunus-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mainz, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mainz-Bingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mannheim, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mansfeld-Südharz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Marburg-Biedenkopf'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mayen-Koblenz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mecklenburgische Seenplatte'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Meißen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Memmingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Merzig-Wadern'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mettmann'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Miesbach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Miltenberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Minden-Lübbecke'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mittelsachsen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Märkisch-Oderland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Märkischer Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mönchengladbach, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mühldorf a.Inn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Mülheim an der Ruhr, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'München'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'München, Landeshauptstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Münster, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neckar-Odenwald-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neu-Ulm'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neuburg-Schrobenhausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neumarkt i.d.OPf.'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neumünster, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neunkirchen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neustadt a.d.Aisch-Bad Windsheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neustadt an der Weinstraße, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Neuwied'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nienburg (Weser)'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nordfriesland'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nordhausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nordsachsen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nordwestmecklenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Northeim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nürnberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Nürnberger Land'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oberallgäu'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oberbergischer Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oberhausen, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oberhavel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oberspreewald-Lausitz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Odenwaldkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oder-Spree'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Offenbach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Offenbach am Main, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oldenburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Oldenburg (Oldenburg), Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Olpe'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ortenaukreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Osnabrück'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Osnabrück, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ostalbkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ostallgäu'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Osterholz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ostholstein'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ostprignitz-Ruppin'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Paderborn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Passau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Peine'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Pfaffenhofen a.d.Ilm'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Pforzheim, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Pinneberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Pirmasens, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Plön'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Potsdam, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Potsdam-Mittelmark'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Prignitz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rastatt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ravensburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Recklinghausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Regen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Regensburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Region Hannover'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Regionalverband Saarbrücken'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rems-Murr-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Remscheid, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rendsburg-Eckernförde'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Reutlingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Erft-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Hunsrück-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Kreis Neuss'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Lahn-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Neckar-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhein-Sieg-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rheingau-Taunus-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rheinisch-Bergischer Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rhön-Grabfeld'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rosenheim'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rostock'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rotenburg (Wümme)'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Roth'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rottal-Inn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Rottweil'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saale-Holzland-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saale-Orla-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saalekreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saalfeld-Rudolstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saarlouis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Saarpfalz-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Salzgitter, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Salzlandkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schaumburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schleswig-Flensburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schmalkalden-Meiningen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwabach'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwalm-Eder-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwandorf'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwarzwald-Baar-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schweinfurt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwerin'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Schwäbisch Hall'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Segeberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Siegen-Wittgenstein'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Sigmaringen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Soest'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Solingen, Klingenstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Sonneberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Speyer, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Spree-Neiße'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'St. Wendel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Stade'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Starnberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Steinburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Steinfurt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Stendal'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Stormarn'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Straubing'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Straubing-Bogen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Stuttgart, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Städteregion Aachen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Suhl, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Sächsische Schweiz-Osterzgebirge'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Sömmerda'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Südliche Weinstraße'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Südwestpfalz'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Teltow-Fläming'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Tirschenreuth'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Traunstein'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Trier, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Trier-Saarburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Tuttlingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Tübingen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Uckermark'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Uelzen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Ulm, Stadtkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Unna'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Unstrut-Hainich-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Unterallgäu'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vechta'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Verden'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Viersen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vogelsbergkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vogtlandkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vorpommern-Greifswald'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vorpommern-Rügen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Vulkaneifel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Waldeck-Frankenberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Waldshut'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Warendorf'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wartburgkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Weiden i.d.OPf.'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Weilheim-Schongau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Weimar, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Weimarer Land'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Weißenburg-Gunzenhausen'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Werra-Meißner-Kreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wesel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wesermarsch'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Westerwaldkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wetteraukreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wiesbaden, Landeshauptstadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wilhelmshaven, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wittenberg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wittmund'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wolfenbüttel'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wolfsburg, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Worms, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wunsiedel i.Fichtelgebirge'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Wuppertal, Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Würzburg'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Zollernalbkreis'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Zweibrücken, kreisfreie Stadt'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ },
+ {
+ "data": {
+ "text/plain": [
+ "'Zwickau'"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "for kreis in kreisValues:\n",
+ " getAndPersistIntensiveCareBeds(timeSeries, kreis)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 30,
+ "id": "d9d4acab",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.724360Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.724143Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.728249Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.727836Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "class MedianOfFreeBedsByKreisTableFactory:\n",
+ " \n",
+ " def __init__(self, dataFrame):\n",
+ " self.dataFrame = dataFrame\n",
+ "\n",
+ " def createMedianOfFreeBedsByKreisTable(self, kreisKey):\n",
+ " self.dataFrame['free_beds_divided_by_all_beds_in_percent'] = self.dataFrame['betten_frei'] / (self.dataFrame['betten_frei'] + self.dataFrame['betten_belegt']) * 100\n",
+ " aggregated = self.dataFrame.groupby(kreisKey).agg(\n",
+ " median_free_beds_in_percent =\n",
+ " pd.NamedAgg(\n",
+ " column = 'free_beds_divided_by_all_beds_in_percent',\n",
+ " aggfunc = 'median'))\n",
+ " return aggregated.sort_values(by = 'median_free_beds_in_percent', ascending = False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "id": "a739d4d1",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.730372Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.730158Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.740833Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.740327Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "from pandas.testing import assert_frame_equal\n",
+ "import statistics\n",
+ "\n",
+ "class MedianOfFreeBedsByKreisTableFactoryTest(unittest.TestCase):\n",
+ "\n",
+ " def test_createMedianOfFreeBedsByKreisTable(self):\n",
+ " # Given\n",
+ " dataFrame = TestHelper.createDataFrame(\n",
+ " columns = ['date', 'betten_frei', 'betten_belegt', 'Kreis'],\n",
+ " data = [ ['2020-04-24', 40, 38, 'Flensburg, Stadt'],\n",
+ " ['2020-04-24', 42, 36, 'Flensburg, Stadt'],\n",
+ " ['2020-04-24', 44, 34, 'Flensburg, Stadt'],\n",
+ " ['2020-04-24', 9, 10, 'Bamberg']],\n",
+ " index = [\n",
+ " 0,\n",
+ " 1,\n",
+ " 2,\n",
+ " 3])\n",
+ " medianOfFreeBedsByKreisTableFactory = MedianOfFreeBedsByKreisTableFactory(dataFrame)\n",
+ " \n",
+ " # When\n",
+ " medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('Kreis')\n",
+ "\n",
+ " # Then\n",
+ " assert_frame_equal(\n",
+ " medianOfFreeBedsByKreisTable,\n",
+ " TestHelper.createDataFrame(\n",
+ " columns = ['median_free_beds_in_percent'],\n",
+ " data = [ [statistics.median([40/(40 + 38) * 100, 42/(42 + 36) * 100, 44/(44 + 34) * 100])],\n",
+ " [9/(9 + 10) * 100]],\n",
+ " index = pd.Index(\n",
+ " name = 'Kreis',\n",
+ " data = [\n",
+ " 'Flensburg, Stadt',\n",
+ " 'Bamberg'\n",
+ " ])),\n",
+ " check_dtype = False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "id": "af22cdc5",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.743284Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.743091Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.764204Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.763646Z"
+ }
+ },
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "test_setKreisOptions (__main__.KreisOptionsSetterTest) ... ok\n",
+ "test_createMedianOfFreeBedsByKreisTable (__main__.MedianOfFreeBedsByKreisTableFactoryTest) ... ok\n",
+ "\n",
+ "----------------------------------------------------------------------\n",
+ "Ran 2 tests in 0.013s\n",
+ "\n",
+ "OK\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "unittest.main(argv = [''], verbosity = 2, exit = False)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "id": "f10704f3",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.766917Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.766669Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.809453Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.808830Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "medianOfFreeBedsByKreisTableFactory = MedianOfFreeBedsByKreisTableFactory(timeSeries)\n",
+ "medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('Kreis')\n",
+ "medianOfFreeBedsByKreisTable.reset_index().to_json('../../docs/data/intensivstationen/medianOfFreeBedsByKreisTable.json', orient = \"records\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 34,
+ "id": "396cb4f8",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.812441Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.811933Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.864332Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.863755Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def createMedianOfFreeBedsByKreisTableForChoroplethMap(medianOfFreeBedsByKreisTableFactory):\n",
+ " medianOfFreeBedsByKreisTable = medianOfFreeBedsByKreisTableFactory.createMedianOfFreeBedsByKreisTable('gemeindeschluessel').reset_index()\n",
+ " return ColumnsAdder(kreise).addKreisAndEinwohnerzahlColumns(medianOfFreeBedsByKreisTable)\n",
+ " \n",
+ "medianOfFreeBedsByKreisTable = createMedianOfFreeBedsByKreisTableForChoroplethMap(medianOfFreeBedsByKreisTableFactory)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 35,
+ "id": "b4247571",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.867473Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.867257Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.873291Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.872643Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "import requests\n",
+ "import json\n",
+ "\n",
+ "\n",
+ "class Datawrapper:\n",
+ "\n",
+ " def __init__(self, accessToken):\n",
+ " self.authHeader = {\"Authorization\": f\"Bearer {accessToken}\"}\n",
+ "\n",
+ " def setChartTitle(self, title):\n",
+ " response = requests.request(\n",
+ " \"PATCH\",\n",
+ " \"https://api.datawrapper.de/v3/charts/dYmYb\",\n",
+ " json={\"title\": title},\n",
+ " headers={\n",
+ " \"Accept\": \"*/*\",\n",
+ " \"Content-Type\": \"application/json\"\n",
+ " } | self.authHeader)\n",
+ " return json.loads(response.text)\n",
+ "\n",
+ " def uploadChartData(self, data: pd.DataFrame):\n",
+ " response = requests.request(\n",
+ " \"PUT\",\n",
+ " \"https://api.datawrapper.de/v3/charts/dYmYb/data\",\n",
+ " data=data.to_csv(\n",
+ " index=False,\n",
+ " columns=['gemeindeschluessel', 'median_free_beds_in_percent', 'Kreis']).encode(\"utf-8\"),\n",
+ " headers={\n",
+ " \"Accept\": \"*/*\",\n",
+ " \"Content-Type\": \"text/csv\"\n",
+ " } | self.authHeader)\n",
+ " return response.text\n",
+ "\n",
+ " def fetchChartData(self):\n",
+ " response = requests.request(\n",
+ " \"GET\",\n",
+ " \"https://api.datawrapper.de/v3/charts/dYmYb/data\",\n",
+ " headers={\n",
+ " \"Accept\": \"text/csv\"\n",
+ " } | self.authHeader)\n",
+ "\n",
+ " return response.text\n",
+ "\n",
+ " def publishChart(self):\n",
+ " response = requests.request(\n",
+ " \"POST\",\n",
+ " \"https://api.datawrapper.de/v3/charts/dYmYb/publish\",\n",
+ " headers={\n",
+ " \"Accept\": \"*/*\"\n",
+ " } | self.authHeader)\n",
+ " return json.loads(response.text)\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 36,
+ "id": "d1b75357",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.876234Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.875963Z",
+ "iopub.status.idle": "2022-12-05T13:34:36.879930Z",
+ "shell.execute_reply": "2022-12-05T13:34:36.879224Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def getChartTitle(dateStart, dateEnd):\n",
+ " def formatDate(date):\n",
+ " return date.strftime(\"%d.%m.%Y\")\n",
+ "\n",
+ " return f\"Median freier Intensivbetten im Zeitraum {formatDate(dateStart)} bis {formatDate(dateEnd)}\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 37,
+ "id": "9de2f34e",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:36.882759Z",
+ "iopub.status.busy": "2022-12-05T13:34:36.882520Z",
+ "iopub.status.idle": "2022-12-05T13:34:40.380031Z",
+ "shell.execute_reply": "2022-12-05T13:34:40.377515Z"
+ }
+ },
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "{'data': {'publicId': 'dYmYb',\n",
+ " 'language': 'de-DE',\n",
+ " 'theme': 'datawrapper',\n",
+ " 'id': 'dYmYb',\n",
+ " 'type': 'd3-maps-choropleth',\n",
+ " 'title': 'Median freier Intensivbetten im Zeitraum 24.04.2020 bis 05.12.2022',\n",
+ " 'lastEditStep': 5,\n",
+ " 'publishedAt': '2022-12-05T13:34:40.155Z',\n",
+ " 'publicUrl': 'https://datawrapper.dwcdn.net/dYmYb/273/',\n",
+ " 'publicVersion': 273,\n",
+ " 'deleted': False,\n",
+ " 'deletedAt': None,\n",
+ " 'forkable': True,\n",
+ " 'isFork': False,\n",
+ " 'metadata': {'data': {'changes': [],\n",
+ " 'transpose': False,\n",
+ " 'vertical-header': True,\n",
+ " 'horizontal-header': True,\n",
+ " 'column-format': {'ags': {'type': 'text'},\n",
+ " 'Kreis': {'type': 'text'},\n",
+ " 'Einwohnerzahl': {'type': 'number',\n",
+ " 'number-append': '',\n",
+ " 'number-format': 'auto',\n",
+ " 'number-divisor': 0,\n",
+ " 'number-prepend': ''},\n",
+ " 'gemeindeschluessel': {'type': 'text'},\n",
+ " 'median_free_beds_in_percent': {'type': 'number'}},\n",
+ " 'upload-method': 'upload'},\n",
+ " 'describe': {'source-name': 'Landkreis-Daten',\n",
+ " 'source-url': 'https://www.intensivregister.de/#/aktuelle-lage/downloads',\n",
+ " 'intro': '',\n",
+ " 'byline': '',\n",
+ " 'aria-description': '',\n",
+ " 'number-format': '-',\n",
+ " 'number-divisor': 0,\n",
+ " 'number-append': '',\n",
+ " 'number-prepend': '',\n",
+ " 'hide-title': False},\n",
+ " 'visualize': {'dark-mode-invert': True,\n",
+ " 'highlighted-series': [],\n",
+ " 'highlighted-values': [],\n",
+ " 'sharing': {'enabled': False, 'auto': True},\n",
+ " 'labels': {'max': 33, 'type': 'places', 'places': [], 'enabled': False},\n",
+ " 'legend': {'size': 170,\n",
+ " 'title': '',\n",
+ " 'labels': 'ranges',\n",
+ " 'enabled': True,\n",
+ " 'reverse': True,\n",
+ " 'labelMax': 'high',\n",
+ " 'labelMin': 'low',\n",
+ " 'position': 'mt',\n",
+ " 'hideItems': [],\n",
+ " 'offsetTop': 0,\n",
+ " 'offsetLeft': 0,\n",
+ " 'interactive': True,\n",
+ " 'labelCenter': 'medium',\n",
+ " 'labelFormat': '0%',\n",
+ " 'orientation': 'horizontal',\n",
+ " 'customLabels': ['Group A', 'Group B', 'Group C']},\n",
+ " 'basemap': 'germany-kreise-2021',\n",
+ " 'tooltip': {'body': 'Median freier Intensivbetten: {{ FORMAT(median_free_beds_in_percent, \"0.0%\") }} \\n\\n',\n",
+ " 'title': '{{ kreis }}',\n",
+ " 'sticky': True,\n",
+ " 'enabled': True},\n",
+ " 'zoomable': True,\n",
+ " 'map-align': 'center',\n",
+ " 'colorscale': {'map': [],\n",
+ " 'mode': 'discrete',\n",
+ " 'stops': 'custom',\n",
+ " 'colors': [{'color': '#F03B20', 'position': 0},\n",
+ " {'color': '#FEB24C', 'position': 0.5},\n",
+ " {'color': '#38A800', 'position': 1}],\n",
+ " 'palette': 0,\n",
+ " 'rangeMax': '100',\n",
+ " 'rangeMin': '0',\n",
+ " 'stopCount': 3,\n",
+ " 'customStops': [None, '10', '25', None, 45.5, 56.1, None],\n",
+ " 'rangeCenter': '',\n",
+ " 'categoryOrder': [],\n",
+ " 'interpolation': 'equidistant',\n",
+ " 'categoryLabels': []},\n",
+ " 'max-height': 650,\n",
+ " 'map-padding': 0,\n",
+ " 'map-key-attr': 'ags',\n",
+ " 'map-type-set': True,\n",
+ " 'chart-type-set': True,\n",
+ " 'max-map-height': 650,\n",
+ " 'min-label-zoom': 1,\n",
+ " 'zoom-button-pos': 'br',\n",
+ " 'map-label-format': '0,0.[00]',\n",
+ " 'text-annotations': [],\n",
+ " 'hide-empty-regions': False,\n",
+ " 'avoid-label-overlap': True},\n",
+ " 'axes': {'keys': 'gemeindeschluessel',\n",
+ " 'values': 'median_free_beds_in_percent'},\n",
+ " 'publish': {'embed-width': 600,\n",
+ " 'embed-height': 785,\n",
+ " 'blocks': {'logo': {'enabled': False},\n",
+ " 'embed': True,\n",
+ " 'download-pdf': False,\n",
+ " 'download-svg': False,\n",
+ " 'get-the-data': True,\n",
+ " 'download-image': True},\n",
+ " 'export-pdf': {},\n",
+ " 'embed-codes': {'embed-method-responsive': '',\n",
+ " 'embed-method-iframe': ''},\n",
+ " 'chart-height': 673.13330078125},\n",
+ " 'annotate': {'notes': ''},\n",
+ " 'custom': {},\n",
+ " 'json_error': None},\n",
+ " 'externalData': '',\n",
+ " 'utf8': False,\n",
+ " 'createdAt': '2022-03-25T16:27:58.000Z',\n",
+ " 'lastModifiedAt': '2022-12-05T13:34:40.155Z',\n",
+ " 'forkedFrom': None,\n",
+ " 'organizationId': None,\n",
+ " 'authorId': 433861,\n",
+ " 'folderId': None},\n",
+ " 'version': 273,\n",
+ " 'url': 'https://datawrapper.dwcdn.net/dYmYb/273/'}"
+ ]
+ },
+ "execution_count": 37,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "from decouple import AutoConfig\n",
+ "\n",
+ "config = AutoConfig(search_path='../..')\n",
+ "dataWrapper = Datawrapper(config('DATAWRAPPER_API_TOKEN'))\n",
+ "dataWrapper.setChartTitle(\n",
+ " getChartTitle(\n",
+ " dateStart=timeSeries['date'].min(),\n",
+ " dateEnd=timeSeries['date'].max()))\n",
+ "dataWrapper.uploadChartData(medianOfFreeBedsByKreisTable)\n",
+ "dataWrapper.publishChart()\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 38,
+ "id": "0218cdb4",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:40.389248Z",
+ "iopub.status.busy": "2022-12-05T13:34:40.388449Z",
+ "iopub.status.idle": "2022-12-05T13:34:40.401978Z",
+ "shell.execute_reply": "2022-12-05T13:34:40.400480Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "def publishGitHubPages():\n",
+ " %cd /home/frankknoll/Dokumente/Corona/projects/HowBadIsMyBatch-pages\n",
+ " ! git add -A\n",
+ " ! git commit -m \"updating data for Intensivstationen\"\n",
+ " ! git push"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a1e83b07",
+ "metadata": {},
+ "source": [
+ "### see https://knollfrank.github.io/HowBadIsMyBatch/intensivstationen.html"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 39,
+ "id": "5f173c2b",
+ "metadata": {
+ "execution": {
+ "iopub.execute_input": "2022-12-05T13:34:40.407363Z",
+ "iopub.status.busy": "2022-12-05T13:34:40.406933Z",
+ "iopub.status.idle": "2022-12-05T13:34:40.411533Z",
+ "shell.execute_reply": "2022-12-05T13:34:40.410663Z"
+ }
+ },
+ "outputs": [],
+ "source": [
+ "# publishGitHubPages()"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3.10.8 ('howbadismybatch-venv')",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.10.8 (main, Nov 24 2022, 14:13:03) [GCC 11.2.0]"
+ },
+ "vscode": {
+ "interpreter": {
+ "hash": "1bce2b9b19ce5f16d695ff75ac05095b3e564c169ff454b58b87cb796c0695b8"
+ }
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}