import datetime
import time
start = datetime.datetime.now()
print(f"Notebook executed on: {start.strftime('%d/%m/%Y %H:%M:%S%Z')} {time.tzname[time.daylight]}")
Notebook executed on: 07/03/2023 09:39:27 CEST
%config InlineBackend.figure_formats = ['svg']
from oscovida import *
overview("Winter Olympics 2022", weeks=5);
overview("Winter Olympics 2022");
compare_plot("Winter Olympics 2022", normalise=True);
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) Cell In[5], line 1 ----> 1 compare_plot("Winter Olympics 2022", normalise=True); File /tank/oscovida/work/oscovida.github.io/oscovida.github.io/.venv/lib/python3.9/site-packages/oscovida/oscovida.py:1976, in compare_plot(country, region, subregion, savefig, normalise, dates, align) 1974 if normalise: 1975 _population = population(country=country, region=region, subregion=subregion) -> 1976 c *= 100000 / _population 1977 d *= 100000 / _population 1979 if not subregion and not region: # i.e. not a region of Germany TypeError: unsupported operand type(s) for /: 'int' and 'NoneType'
# load the data
cases, deaths = get_country_data("Winter Olympics 2022")
# get population of the region for future normalisation:
inhabitants = population("Winter Olympics 2022")
print(f'Population of "Winter Olympics 2022": {inhabitants} people')
# compose into one table
table = compose_dataframe_summary(cases, deaths)
# show tables with up to 1000 rows
pd.set_option("display.max_rows", 1000)
# display the table
table
Population of "Winter Olympics 2022": None people
total cases | daily new cases | total deaths | daily new deaths | |
---|---|---|---|---|
2023-03-06 | 535 | 0 | 0 | 0 |
2023-03-05 | 535 | 0 | 0 | 0 |
2023-03-04 | 535 | 0 | 0 | 0 |
2023-03-03 | 535 | 0 | 0 | 0 |
2023-03-02 | 535 | 0 | 0 | 0 |
... | ... | ... | ... | ... |
2020-01-27 | 0 | 0 | 0 | 0 |
2020-01-26 | 0 | 0 | 0 | 0 |
2020-01-25 | 0 | 0 | 0 | 0 |
2020-01-24 | 0 | 0 | 0 | 0 |
2020-01-23 | 0 | 0 | 0 | 0 |
1139 rows × 4 columns
print(f"Download of data from Johns Hopkins university: cases at {fetch_cases_last_execution()} and "
f"deaths at {fetch_deaths_last_execution()}.")
Download of data from Johns Hopkins university: cases at 07/03/2023 09:31:22 and deaths at 07/03/2023 09:31:21.
# to force a fresh download of data, run "clear_cache()"
print(f"Notebook execution took: {datetime.datetime.now()-start}")
Notebook execution took: 0:00:15.214414