In [1]:
%config InlineBackend.figure_formats = ['svg']
import matplotlib.pyplot as plt
import pandas as pd

# use library from oscovida.github.io
import oscovida
In [2]:
oscovida.display_binder_link("2020-04-30-bbc-germany-increasing.ipynb")
In [3]:
cases, deaths = oscovida.get_country_data("Germany")
In [33]:
fig, ax = plt.subplots(figsize=(10, 3))     # figure size in inches
tmp = cases.diff()["2020-04-26":"2020-04-30"]
ax.bar(tmp.index, tmp.values, alpha=0.5, color="C1", label="new")
ax.set_ylabel("daily change")
ax.legend()
fig.autofmt_xdate()

fig.savefig("2020-04-30-bbc-germany-increasing1.svg")
2020-10-31T09:39:02.464764 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [39]:
fig, ax = plt.subplots(figsize=(10, 3))
oscovida.plot_daily_change(ax, cases["2020-03":"2020-05"], "C1")

fig.savefig("2020-04-30-bbc-germany-increasing2.svg")
2020-10-31T09:41:38.586238 image/svg+xml Matplotlib v3.3.2, https://matplotlib.org/
In [13]:
table = oscovida.compose_dataframe_summary(cases, deaths)
table["2020-05-01":"2020-04-01"]
Out[13]:
total cases daily new cases total deaths daily new deaths
2020-05-01 164077 1068 6736 113
2020-04-30 163009 1470 6623 156
2020-04-29 161539 1627 6467 153
2020-04-28 159912 1154 6314 188
2020-04-27 158758 988 6126 150
2020-04-26 157770 1257 5976 99
2020-04-25 156513 1514 5877 117
2020-04-24 154999 1870 5760 185
2020-04-23 153129 2481 5575 296
2020-04-22 150648 2357 5279 246
2020-04-21 148291 1226 5033 171
2020-04-20 147065 1881 4862 276
2020-04-19 145184 1842 4586 127
2020-04-18 143342 1945 4459 107
2020-04-17 141397 3699 4352 300
2020-04-16 137698 2945 4052 248
2020-04-15 134753 3394 3804 510
2020-04-14 131359 1287 3294 100
2020-04-13 130072 2218 3194 172
2020-04-12 127854 2946 3022 286
2020-04-11 124908 2737 2736 -31
2020-04-10 122171 3990 2767 160
2020-04-09 118181 4885 2607 258
2020-04-08 113296 5633 2349 333
2020-04-07 107663 4289 2016 206
2020-04-06 103374 3251 1810 226
2020-04-05 100123 4031 1584 140
2020-04-04 96092 4933 1444 169
2020-04-03 91159 6365 1275 168
2020-04-02 84794 6922 1107 187
2020-04-01 77872 6064 920 145
In [7]:
# save as markdown for easier inclusion in webpage
table.head(n=10).to_markdown(open('2020-04-30-bbc-germany-increasing-table.md', "tw"))