Created
March 30, 2021 20:33
-
-
Save kudaras/6b65912259df35c6cbe36e52a4aa6518 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
amziaus_grupes = { | |
'60-69': 'neprioritetiniai', | |
'50-59': 'neprioritetiniai', | |
'80-89': 'prioritetiniai', | |
'Centenarianai': 'prioritetiniai', | |
'70-79': 'prioritetiniai', | |
'90-99': 'prioritetiniai', | |
'20-29': 'neprioritetiniai', | |
'40-49': 'neprioritetiniai', | |
'30-39': 'neprioritetiniai', | |
'0-9': 'neprioritetiniai', | |
'10-19': 'neprioritetiniai', | |
'Nenustatyta': 'neprioritetiniai' | |
} | |
df = pd.read_csv("~/Downloads/lt-covid19-agedist.csv") | |
df['Skiepų amžiaus grupė'] = df['age'].apply(lambda x: amziaus_grupes.get(x)) | |
df1 = df[['day', | |
'Skiepų amžiaus grupė', | |
'deaths_population_daily', | |
'deaths_3_daily']].groupby(['Skiepų amžiaus grupė', 'day']).agg('sum') | |
df1['ratio'] = df1.deaths_3_daily.rolling(7).mean() * 100.0 / df1.deaths_population_daily.rolling(7).mean() | |
ax = df1['ratio'].unstack().T.plot(kind='line') | |
ax.set_ylabel("Mirčių su COVID procentas") | |
ax.set_xlabel("Data") | |
ax.set_title("Mirčių, susijusių su COVID, procentas") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment