J
J
John-Osborne2020-04-18 20:12:28
Python
John-Osborne, 2020-04-18 20:12:28

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()

I get this result:
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%

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.
But the fact is that each country may have a peak at different times, and I do not take this into account.
And I don't know how right I'm drawing conclusions. It seems to me that I am mistaken somewhere.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2020-04-18
@dimonchik2013

0_b611a_4e7ae438_L.jpg
you interpret correctly , you
are not mistaken anywhere
except ...

V
Vladimir Kuts, 2020-04-18
@fox_12

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.

Well, cool - world-famous epidemiologists and virologists are still very careful in their assessments and conclusions until the end of the epidemic - and you have already deduced everything with a simple mathematical operation)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question