Created
May 14, 2021 23:13
-
-
Save Oberon00/f363332e0099b3eefcbc1366e0f1f154 to your computer and use it in GitHub Desktop.
Some calculations about the velocity of the Austrian vaccination campaign
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
import matplotlib.dates | |
import matplotlib.ticker | |
import seaborn as sns | |
# Get from https://info.gesundheitsministerium.gv.at/?re=opendata | |
bbg = pd.read_csv('timeline-bbg.csv', sep=';') | |
states = pd.read_csv('timeline-bundeslaendermeldungen.csv', sep=';') | |
states['BundeslandID'].replace(0, -1, inplace=True) | |
merged = bbg.merge(states, on=['Datum', 'BundeslandID'], how='outer', suffixes=('', '_y')) | |
merged['Name'].fillna(merged['Name_y'], inplace=True) | |
merged['Bevölkerung'].fillna(merged['Bevölkerung_y'], inplace=True) | |
merged.drop(['Name_y', 'Bevölkerung_y'], 'columns', inplace=True) | |
merged['ImpfungProAuslieferung'] = merged['GemeldeteImpfungenLaender'] / merged['Auslieferungen'] | |
merged.sort_values(by='Datum', inplace=True) | |
events = merged.melt( | |
id_vars=['Datum', 'BundeslandID', 'Name'], | |
value_vars=['Auslieferungen', 'Bestellungen', 'GemeldeteImpfungenLaender'], | |
var_name="event") | |
events.sort_values(by=['Datum', 'event'], inplace=True) | |
fig, ax = plt.subplots() | |
SEL = ('Steiermark', 'Oberösterreich', 'Niederösterreich') | |
sns.lineplot(x='Datum', y='value', style="event", hue="Name", data=events[events['Name'].isin(SEL)], ax=ax, style_order=['GemeldeteImpfungenLaender', 'Auslieferungen', 'Bestellungen']) | |
#sns.lineplot(x='Datum', y='ImpfungProAuslieferung', hue="Name", data=merged[merged['Name'].isin(SEL)]) | |
ax.xaxis.set_major_locator(matplotlib.dates.WeekdayLocator( | |
byweekday=matplotlib.dates.MO, interval=1)) | |
ax.xaxis.set_major_formatter(matplotlib.dates.DateFormatter("KW%W")) | |
fig.autofmt_xdate() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment