Set of data visualizations for COVID-19 data from Johns Hopkins CSSE department. Charts of time series trends are inspired by the plot from this article in the Financial Times, graphics by John Burn-Murdoch.
The file covid_visualization.ipynb
contains a set of functions for extracting key pieces of data from the JHU dataset. Feel free to use or adapt these functions for your specific use case:
covidData(country, output=1, start=100)
country
โ string with country name of interest
output
โ type of output (1
for confirmed cases, 2
for recovered cases, 3
for deaths, 4
for net (open) cases โ default 1
)
start
โ number of cases after which to report data (e.g. starting after the nth case โ default 100
)
doubling_rate(country, output=1)
The growth rate (r) is calculated from the difference in cases between the most recent data point and two days prior:
xn = xn โ 2 ยท (1 + r)2
From the value of r, the projected number of days for doubling (n) can be calculated:
(1 + r)n = 2
country
โ string with country name of interest
output
โ type of output (1
for confirmed cases, 2
for recovered cases, and 3
for deaths โ default 1
)