Answer the question
In order to leave comments, you need to log in
Am I interpreting the data correctly?
I was wondering how fast the coronavirus is spreading in different countries.
I wrote a script that shows the average percentage of new infections compared to the previous day.
My goal is to find out how much of a threat the coronavirus poses to Russia.
The coronavirus has been in Russia for 78 days. So I decided to take the statistics for the last 30 days. Or rather, I take statistics starting from day 48.
import httpx
import pandas as pd
from io import StringIO
import matplotlib.pyplot as plt
import numpy as np
url = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv'
df = pd.read_csv(StringIO(httpx.get(url).text))
avg_k = {}
for _, series in df.iterrows():
country = series.array[1]
cases = list(filter(lambda x: x != 0, series.array[4:]))
if len(cases) < 48 + 10 or cases[-1] < 15000:
continue
cases = cases[48:]
avg_k[country] = np.average([cases[i] / cases[i - 1] for i in range(1, len(cases))])
plt.semilogy(range(len(cases)), cases, label=country)
for k, v in sorted(avg_k.items(), key=lambda x: x[1], reverse=True):
print(f"{k}: {(v - 1) * 100:.3f}%")
plt.legend(loc="lower right")
plt.show()
US: 19.714%
Russia: 19.251%
United Kingdom: 13.918%
France: 12.857%
Germany: 10.495%
Belgium: 9.668%
Spain: 8.503%
Italy: 5.128%
Iran: 2.421%
China: 0.014%
Answer the question
In order to leave comments, you need to log in
you interpret correctly , you
are not mistaken anywhere
except ...
From which I conclude that in Russia the coronavirus will proceed in the same way as in European countries, and perhaps the situation will be the same as in the United States.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question