Note
Go to the end to download the full example code
Visualisation des données par pays¶
Ces séries représentent celles des décès. Le nombre de cas positifs est différent selon les pays de par leur capacité de tests et au nombreux cas asymptomatiques.
Récupération des données¶
Les décès.
from aftercovid.preprocess import ts_normalise_negative_values
import matplotlib.pyplot as plt
import pandas
url = ("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/"
"master/csse_covid_19_data/"
"csse_covid_19_time_series/time_series_covid19_deaths_global.csv")
df = pandas.read_csv(url)
df.head()
Les cas positifs.
url = ("https://raw.githubusercontent.com/CSSEGISandData/COVID-19/"
"master/csse_covid_19_data/"
"csse_covid_19_time_series/time_series_covid19_confirmed_global.csv")
dfpos = pandas.read_csv(url)
dfpos.head()
Tous les pays
print(" --- ".join(sorted(set(df['Country/Region']))))
Afghanistan --- Albania --- Algeria --- Andorra --- Angola --- Antarctica --- Antigua and Barbuda --- Argentina --- Armenia --- Australia --- Austria --- Azerbaijan --- Bahamas --- Bahrain --- Bangladesh --- Barbados --- Belarus --- Belgium --- Belize --- Benin --- Bhutan --- Bolivia --- Bosnia and Herzegovina --- Botswana --- Brazil --- Brunei --- Bulgaria --- Burkina Faso --- Burma --- Burundi --- Cabo Verde --- Cambodia --- Cameroon --- Canada --- Central African Republic --- Chad --- Chile --- China --- Colombia --- Comoros --- Congo (Brazzaville) --- Congo (Kinshasa) --- Costa Rica --- Cote d'Ivoire --- Croatia --- Cuba --- Cyprus --- Czechia --- Denmark --- Diamond Princess --- Djibouti --- Dominica --- Dominican Republic --- Ecuador --- Egypt --- El Salvador --- Equatorial Guinea --- Eritrea --- Estonia --- Eswatini --- Ethiopia --- Fiji --- Finland --- France --- Gabon --- Gambia --- Georgia --- Germany --- Ghana --- Greece --- Grenada --- Guatemala --- Guinea --- Guinea-Bissau --- Guyana --- Haiti --- Holy See --- Honduras --- Hungary --- Iceland --- India --- Indonesia --- Iran --- Iraq --- Ireland --- Israel --- Italy --- Jamaica --- Japan --- Jordan --- Kazakhstan --- Kenya --- Kiribati --- Korea, North --- Korea, South --- Kosovo --- Kuwait --- Kyrgyzstan --- Laos --- Latvia --- Lebanon --- Lesotho --- Liberia --- Libya --- Liechtenstein --- Lithuania --- Luxembourg --- MS Zaandam --- Madagascar --- Malawi --- Malaysia --- Maldives --- Mali --- Malta --- Marshall Islands --- Mauritania --- Mauritius --- Mexico --- Micronesia --- Moldova --- Monaco --- Mongolia --- Montenegro --- Morocco --- Mozambique --- Namibia --- Nauru --- Nepal --- Netherlands --- New Zealand --- Nicaragua --- Niger --- Nigeria --- North Macedonia --- Norway --- Oman --- Pakistan --- Palau --- Panama --- Papua New Guinea --- Paraguay --- Peru --- Philippines --- Poland --- Portugal --- Qatar --- Romania --- Russia --- Rwanda --- Saint Kitts and Nevis --- Saint Lucia --- Saint Vincent and the Grenadines --- Samoa --- San Marino --- Sao Tome and Principe --- Saudi Arabia --- Senegal --- Serbia --- Seychelles --- Sierra Leone --- Singapore --- Slovakia --- Slovenia --- Solomon Islands --- Somalia --- South Africa --- South Sudan --- Spain --- Sri Lanka --- Sudan --- Summer Olympics 2020 --- Suriname --- Sweden --- Switzerland --- Syria --- Taiwan* --- Tajikistan --- Tanzania --- Thailand --- Timor-Leste --- Togo --- Tonga --- Trinidad and Tobago --- Tunisia --- Turkey --- Tuvalu --- US --- Uganda --- Ukraine --- United Arab Emirates --- United Kingdom --- Uruguay --- Uzbekistan --- Vanuatu --- Venezuela --- Vietnam --- West Bank and Gaza --- Winter Olympics 2022 --- Yemen --- Zambia --- Zimbabwe
On en sélectionne quelques-uns.
En colonne.
cols = list(eur['Country/Region'])
tf = eur.T.iloc[4:]
tf.columns = cols
tf.tail()
Les cas positifs.
colspos = list(eurpos['Country/Region'])
tfpos = eurpos.T.iloc[4:]
tfpos.columns = colspos
tfpos.tail()
Nombre de décès par pays¶
Nombre de décès par pays par jour¶
Cas positifs par pays¶
Cas positifs par pays par jour¶
fig, ax = plt.subplots(1, 3, figsize=(14, 6))
dtfpos = tfpos.diff()
dtfpos.plot(
logy=False, lw=3, title="Nombre de cas positifs COVID\npar jour",
ax=ax[0])
dtfpos.plot(logy=True, lw=3, ax=ax[1])
tfpos.tail(
n=60).plot(
logy=True,
lw=3,
title="Nombre de cas positifs COVID",
ax=ax[2])
On lisse sur une semaine.
tdroll = tf.rolling(7, center=False).mean()
tdroll.tail()
Séries lissées.
fig, ax = plt.subplots(1, 3, figsize=(14, 6))
tdroll.plot(logy=False, lw=3, ax=ax[0],
title="Nombre de décès COVID lissé sur une semaine")
tdroll.plot(logy=True, lw=3, ax=ax[1],
title="Nombre de décès COVID lissé sur une semaine")
tdroll.tail(60).plot(logy=True, lw=3, ax=ax[2],
title="Nombre de décès COVID lissé sur une semaine")
tdposroll = tfpos.rolling(7, center=False).mean()
tdposroll.plot(logy=False, lw=3, ax=ax[0],
title="Nombre de cas positifs COVID lissé sur une semaine")
tdposroll.plot(logy=True, lw=3, ax=ax[1],
title="Nombre de cas positifs COVID lissé sur une semaine")
tdposroll.tail(60).plot(
logy=True,
lw=3,
ax=ax[2],
title="Nombre de cas positifs COVID lissé sur une semaine")
Séries décalées¶
On ne s’intéresse qu’aux séries de décès. Les séries des cas positifs sont plutôt des estimateurs imparfaits. On compare les séries en prenant comme point de départ la date qui correspond au 20ième décès.
def find_day(ts, th):
tsth = ts[ts >= th]
return tsth.index[0]
def delag(ts, th=21, begin=-2):
index = find_day(ts, th)
loc = ts.index.get_loc(index)
values = ts.reset_index(drop=True)
return values[loc + begin:].reset_index(drop=True)
print(find_day(tdroll['France'], 25), delag(tdroll['France'])[:15])
3/12/20 0 12.000000
1 16.142857
2 22.428571
3 28.285714
4 38.285714
5 49.000000
6 59.285714
7 76.857143
8 93.285714
9 107.571429
10 135.428571
11 188.428571
12 255.714286
13 339.000000
14 440.714286
Name: France, dtype: float64
On décale pour chaque pays.
dl.tail()
Graphes.
Le fléchissement indique que la propagation n’est plus logarithmique après la fin du confinement.
Séries différentielles¶
C’est surtout celle-ci qu’on regarde pour contrôler l’évolution de l’épidémie. Certaines valeurs sont négatives laissant penser que la façon de reporter les décès a évolué au cours du temps. C’est problématique lorsqu’on souhaite caler un modèle.
Et pour la France.
On continue néanmoins mais en corrigeant ces séries qu’il n’y ait plus aucune valeur négative.
fig, ax = plt.subplots(1, 3, figsize=(14, 6))
tfdiff.plot(
logy=False, lw=3, ax=ax[0],
title="Nombre de décès COVID par jour lissé par semaine")
ax[0].set_ylim(0)
tfdiff.plot(
logy=True, lw=3, ax=ax[1],
title="Nombre de décès COVID par jour lissé par semaine")
tfdiff.tail(60).plot(
logy=True, lw=3, ax=ax[2],
title="Nombre de décès COVID par jour lissé par semaine")
Les mêmes chiffres en recalant les séries au jour du 20ième décès.
somewhereaftercovid_39_std/aftercovid/aftercovid/preprocess/ts.py:96: RuntimeWarning: invalid value encountered in divide
res[d + 1:-d] = (ret[n:] - ret[:-n]) / (wet[n:] - wet[:-n])
somewhereaftercovid_39_std/aftercovid/aftercovid/preprocess/ts.py:99: RuntimeWarning: invalid value encountered in divide
res[-i - 1] = numpy.divide(ret[-1] - ret[-(i + d) - 1],
nan,4.857142857142858,7.428571428571429,7.428571428571427,18.28571428571429,26.42857142857143,38.85714285714285,44.857142857142875,71.14285714285714,81.28571428571428,110.71428571428572,129.99999999999994,168.57142857142867,211.85714285714278,281.2857142857142,325.0,432.0,505.0000000000002,585.0,658.1428571428569,718.7142857142862,772.1428571428569,808.0,820.0,854.7142857142853,865.7142857142862,852.1428571428569,834.0,803.5714285714294,797.2857142857138,772.1428571428569,728.4285714285706,697.5714285714294,665.5714285714294,652.5714285714275,630.7142857142862,572.9999999999982,559.4285714285725,552.5714285714275,560.1428571428587,491.0,463.42857142857247,442.28571428571377,460.8571428571413,429.85714285714494,406.0,360.28571428571377,408.42857142857247,391.0,381.28571428571377,362.8571428571413,365.42857142857247,340.8571428571413,288.42857142857247,314.0,296.28571428571377,272.42857142857247,255.8571428571413,226.0,218.1428571428587,250.8571428571413,196.85714285714494,193.8571428571413,188.0,186.71428571428623,178.1428571428587,178.7142857142826,165.71428571428623,155.0,134.57142857143117,137.8571428571413,122.57142857142753,112.0,88.42857142857247,167.0,159.28571428571377,169.85714285714494,-125.0,-94.42857142857247,-110.1428571428587,-117.28571428571377,-215.28571428571377,-221.8571428571413,-232.1428571428587,41.8571428571413,1.428571428572468,1.571428571427532,2.0,1.857142857144936,1.428571428572468,1.285714285713766,1.285714285713766,1.285714285713766,1.142857142858702,0.42857142856883,0.285714285713766,0.142857142858702,0.0,0.0,0.0,0.0,0.0,168.42857142857247,169.42857142856883,169.57142857143117,169.71428571428623,169.8571428571413,170.1428571428587,170.57142857142753,3.285714285713766,2.714285714286234,2.857142857141298,3.142857142858702,4.285714285713766,5.285714285713766,5.428571428572468,6.714285714286234,6.285714285713766,6.0,6.0,5.285714285713766,4.571428571427532,4.714285714286234,2.571428571427532,2.57142857143117,2.571428571427532,2.571428571427532,2.428571428572468,2.428571428572468,2.142857142855064,2.428571428572468,2.428571428572468,2.42857142856883,2.285714285717404,2.142857142855064,1.857142857144936,1.857142857141298,1.714285714286234,1.714285714286234,1.714285714286234,1.714285714282596,1.714285714286234,2.142857142858702,2.0,1.857142857141298,1.857142857144936,1.857142857141298,5.428571428572468,8.857142857141298,8.285714285713766,8.142857142858702,8.285714285713766,8.285714285713766,8.285714285713766,14.857142857144936,11.857142857141298,11.428571428572468,15.0,16.285714285713766,16.285714285713766,16.285714285713766,10.0,12.714285714286234,31.142857142858702,29.714285714286234,31.571428571427532,31.571428571427532,31.57142857143117,32.285714285713766,36.285714285713766,24.857142857141298,26.142857142858702,24.714285714286234,24.714285714286234,24.714285714282596,31.714285714286234,32.57142857143117,31.857142857141298,34.0,58.1428571428587,58.142857142855064,58.1428571428587,60.285714285713766,63.142857142855064,62.0,66.42857142857247,47.0,47.0,47.0,47.42857142857247,58.57142857142753,87.85714285714494,100.8571428571413,106.8571428571413,106.85714285714494,106.8571428571413,116.42857142857247,128.57142857142753,113.0,101.85714285714494,105.28571428571377,105.28571428571377,105.28571428571377,106.85714285714494,72.42857142856883,108.1428571428587,122.14285714285506,122.0,122.0,122.0,116.2857142857174,153.57142857142753,110.14285714285506,102.1428571428587,120.42857142857247,120.42857142856883,120.42857142857247,128.42857142856883,102.57142857143481,121.57142857142753,123.57142857142753,120.85714285714494,120.85714285713766,120.85714285714494,124.0,143.7142857142826,136.14285714286234,138.28571428571013,139.57142857142753,139.5714285714348,139.57142857142753,148.42857142857247,155.4285714285652,157.14285714286234,159.7142857142826,160.85714285714494,160.85714285714494,160.85714285713766,175.14285714286234,171.0,378.85714285713766,406.7142857142899,422.14285714285506,422.14285714285506,422.14285714286234,441.14285714285506,407.14285714285506,283.85714285714494,282.14285714285506,276.57142857142753,276.57142857142753,276.5714285714348,272.57142857142753,334.7142857142826,276.2857142857174,261.42857142857247,264.2857142857101,264.2857142857174,264.2857142857101,268.2857142857174,282.85714285714494,285.4285714285652,297.5714285714348,292.7142857142826,292.7142857142826,292.7142857142899,276.85714285714494,263.2857142857101,249.57142857142753,237.71428571428987,226.28571428571013,226.2857142857174,226.28571428571013,225.2857142857174,162.14285714285506,176.42857142857247,186.57142857142753,196.0,196.0,196.0,195.2857142857174,250.7142857142826,225.2857142857174,204.7142857142826,186.0,186.0,186.0,178.14285714286234,159.85714285713766,157.42857142857247,149.57142857142753,128.2857142857174,128.28571428571013,128.2857142857174,123.14285714285506,131.71428571428987,141.57142857142753,144.7142857142826,144.71428571428987,144.7142857142826,144.71428571428987,136.57142857142753,141.14285714285506,105.85714285714494,119.7142857142826,148.14285714285506,148.14285714286234,148.14285714285506,171.0,179.0,206.85714285714494,200.57142857142753,205.7142857142826,205.71428571428987,205.7142857142826,213.42857142857247,212.85714285714494,251.28571428571013,280.2857142857174,303.85714285714494,303.85714285713766,303.85714285714494,348.42857142857247,374.42857142857247,379.14285714285506,395.0,411.14285714285506,411.14285714286234,411.14285714285506,410.42857142857247,430.14285714285506,439.85714285714494,428.0,438.14285714285506,438.14285714285506,438.14285714286234,459.14285714285506,465.14285714285506,476.2857142857174,487.85714285713766,480.14285714286234,480.14285714285506,480.14285714285506,450.57142857142753,416.85714285714494,373.14285714285506,355.2857142857174,336.2857142857101,336.2857142857247,336.2857142857101,312.4285714285652,300.0,307.42857142857974,301.2857142857101,291.5714285714348,291.57142857142026,291.5714285714348,281.85714285714494,246.0,254.14285714285506,241.14285714285506,285.14285714285506,285.14285714285506,285.14285714285506,261.0,275.14285714285506,244.85714285714494,226.28571428572468,160.0,160.0,160.0,141.14285714285506,119.71428571427532,118.85714285714494,117.85714285714494,93.14285714285506,93.14285714285506,93.14285714286962,159.85714285713038,168.42857142857974,135.85714285714494,215.71428571427532,300.0,300.0,300.0,236.5714285714348,223.0,245.0,160.14285714285506,75.85714285714494,98.28571428571013,98.28571428572468,83.42857142856519,86.57142857143481,82.57142857142026,91.14285714285506,112.42857142857974,90.0,90.0,106.0,102.0,102.71428571427532,100.42857142857974,93.28571428571013,93.28571428571013,93.28571428572468,82.42857142856519,68.14285714285506,86.85714285714494,87.71428571428987,87.14285714285506,87.14285714285506,87.14285714285506,90.85714285714494,107.57142857143481,82.71428571427532,83.42857142857974,89.28571428571013,89.28571428571013,89.28571428572468,79.28571428571013,77.71428571428987,89.0,92.28571428571013,82.28571428571013,82.28571428572468,82.28571428571013,86.0,100.14285714285506,91.71428571428987,79.28571428571013,78.14285714285506,78.14285714285506,78.14285714285506,76.71428571428987,57.428571428579744,51.42857142856519,45.71428571428987,40.142857142855064,40.142857142855064,40.142857142855064,39.857142857144936,42.71428571428987,41.0,41.0,40.71428571427532,40.71428571428987,40.71428571428987,34.571428571420256,26.0,27.714285714289872,23.0,41.428571428579744,41.571428571420256,41.57142857143481,40.42857142856519,46.57142857143481,40.42857142856519,59.428571428579744,43.71428571427532,43.57142857143481,43.571428571420256,40.142857142869616,38.571428571420256,40.428571428579744,24.142857142855064,21.571428571420256,21.571428571434808,21.571428571420256,24.571428571434808,20.0,19.0,18.857142857144936,18.142857142855064,18.142857142855064,18.142857142855064,14.28571428572468,15.71428571427532,18.142857142855064,16.714285714289872,18.857142857144936,18.857142857144936,18.857142857144936,20.71428571427532,17.571428571434808,13.428571428565192,16.28571428572468,13.142857142855064,13.142857142855064,13.142857142855064,12.285714285710128,11.571428571434808,10.571428571434808,12.428571428565192,13.285714285710128,13.28571428572468,13.285714285710128,14.142857142855064,16.428571428565192,17.571428571434808,15.714285714289872,17.857142857144936,17.857142857130384,17.857142857144936,21.28571428572468,25.0,32.857142857130384,35.428571428579744,37.857142857144936,37.857142857144936,37.857142857130384,53.57142857143481,64.28571428571013,64.0,69.85714285714494,74.28571428571013,74.28571428572468,74.28571428571013,68.85714285714494,64.85714285714494,68.0,68.0,66.28571428571013,66.28571428571013,66.28571428572468,67.14285714285506,73.14285714285506,80.42857142856519,85.28571428572468,95.14285714285506,95.14285714285506,95.14285714285506,106.0,112.57142857143481,115.28571428571013,122.42857142856519,123.42857142857974,123.42857142856519,123.42857142857974,115.57142857142026,116.14285714285506,111.71428571428987,111.28571428571013,113.57142857143481,113.57142857142026,113.57142857143481,111.71428571428987,103.71428571427532,96.42857142857974,82.57142857142026,70.71428571428987,70.71428571428987,70.71428571428987,66.42857142856519,68.85714285714494,70.14285714285506,74.42857142856519,70.42857142857974,70.42857142856519,70.42857142857974,72.57142857142026,62.142857142855064,63.857142857144936,63.71428571428987,63.71428571428987,63.71428571427532,63.71428571428987,56.71428571428987,53.571428571420256,44.57142857143481,32.857142857144936,33.42857142856519,33.428571428579744,33.42857142856519,32.71428571428987,37.571428571420256,40.142857142869616,40.857142857130384,45.0,45.0,45.0,42.857142857144936,29.428571428579744,27.285714285710128,30.857142857144936,28.0,28.0,28.0,29.0,32.0,30.428571428565192,26.428571428579744,22.571428571420256,22.571428571434808,22.571428571420256,22.28571428572468,26.71428571427532,29.571428571434808,31.428571428565192,33.71428571428987,33.71428571428987,33.71428571428987,26.0,26.428571428565192,24.714285714289872,22.142857142855064,19.428571428565192,19.428571428579744,19.428571428565192,27.142857142855064,19.28571428572468,22.142857142855064,24.285714285710128,24.142857142855064,24.142857142855064,24.142857142855064,22.571428571434808,26.714285714289872,22.571428571420256,22.428571428579744,19.571428571420256,19.571428571434808,19.571428571420256,16.571428571434808,17.285714285710128,18.428571428579744,18.142857142855064,20.714285714289872,20.71428571427532,20.714285714289872,25.142857142855064,26.571428571434808,25.142857142855064,27.285714285710128,29.142857142855064,29.142857142855064,29.142857142869616,21.571428571420256,26.428571428579744,22.428571428565192,28.428571428565192,31.571428571434808,31.714285714289872,31.71428571427532,46.428571428579744,43.571428571420256,54.57142857143481,49.42857142856519,46.857142857144936,46.71428571428987,46.71428571428987,44.142857142855064,49.28571428571013,45.428571428579744,50.28571428571013,44.42857142856519,44.428571428579744,44.42857142856519,49.428571428579744,52.28571428571013,56.28571428571013,55.142857142855064,55.142857142855064,55.142857142869616,55.142857142855064,62.0,62.28571428571013,72.28571428571013,61.71428571428987,75.57142857143481,75.57142857142026,75.57142857143481,80.42857142856519,99.14285714285506,95.85714285714494,111.85714285714494,117.85714285714494,117.85714285714494,117.85714285714494,122.42857142856519,127.71428571428987,132.71428571427532,139.85714285714494,140.28571428572468,140.28571428571013,140.28571428571013,143.0,157.0,164.85714285714494,166.85714285714494,175.0,175.0,175.0,175.85714285714494,179.57142857142026,180.85714285714494,181.85714285714494,153.4285714285652,153.42857142857974,153.4285714285652,192.14285714285506,185.42857142857974,193.71428571428987,223.71428571427532,279.2857142857247,279.2857142857101,279.2857142857101,289.42857142857974,282.14285714285506,305.2857142857101,300.5714285714348,286.14285714285506,286.14285714285506,286.14285714285506,266.5714285714348,247.0,226.57142857142026,207.42857142857974,201.71428571427532,201.71428571428987,201.71428571428987,135.4285714285652,178.28571428571013,157.28571428572468,153.85714285714494,143.28571428571013,143.28571428571013,143.28571428571013,166.28571428572468,139.4285714285652,136.42857142857974,119.71428571427532,103.14285714285506,103.14285714286962,103.14285714285506,80.14285714285506,79.57142857142026,60.57142857143481,48.42857142856519,81.14285714286962,81.14285714285506,81.14285714285506,81.14285714285506,91.0,91.0,91.0,98.42857142856519,98.42857142857974,98.42857142856519,98.42857142857974,23.571428571420256,23.571428571434808,23.571428571420256,21.28571428572468,21.285714285710128,21.285714285710128,21.28571428572468,75.57142857142026,75.57142857143481,75.57142857142026,80.42857142857974,80.42857142856519,80.42857142857974,80.42857142856519,51.0,51.0,51.0,0.0,0.0,0.0,0.0,0.0,88.14285714285506,88.14285714285506,114.85714285714494,114.85714285714494,114.85714285714494,114.85714285714494,160.4285714285652,72.28571428571013,72.28571428572468,78.28571428571013,78.28571428571013,78.28571428572468,78.28571428571013,63.0,63.0,63.0,59.0,59.0,59.0,95.28571428571013,65.0,65.0,65.0,82.14285714285506,82.14285714285506,82.14285714286962,45.857142857130384,74.14285714286962,74.14285714285506,74.14285714285506,28.285714285710128,72.57142857143481,72.57142857142026,72.57142857143481,43.571428571420256,43.57142857143481,66.14285714285506,99.85714285714494,55.57142857143481,55.571428571420256,55.57142857143481,56.28571428571013,78.0,55.42857142856519,65.14285714286962,65.14285714285506,65.14285714285506,65.14285714285506,81.85714285714494,60.142857142855064,60.142857142855064,44.428571428579744,44.42857142856519,44.42857142856519,44.428571428579744,46.42857142856519,46.428571428579744,46.42857142856519,53.428571428579744,53.42857142856519,53.42857142856519,53.428571428579744,52.142857142855064,52.142857142855064,52.142857142855064,45.28571428572468,45.28571428571013,45.28571428571013,45.28571428571013,43.142857142869616,43.142857142855064,43.142857142855064,44.571428571420256,44.57142857143481,44.57142857143481,44.571428571420256,50.428571428579744,50.42857142856519,50.42857142856519,88.42857142857974,88.42857142856519,88.42857142857974,88.42857142856519,102.14285714285506,102.14285714285506,102.14285714286962,88.28571428571013,88.28571428571013,88.28571428571013,88.28571428572468,95.42857142856519,95.42857142857974,95.42857142856519,119.85714285714494,119.85714285714494,119.85714285714494,119.85714285713038,107.42857142857974,107.42857142856519,107.42857142857974,76.0,76.0,76.0,76.0,45.571428571420256,45.57142857143481,45.571428571420256,53.57142857143481,53.57142857143481,53.571428571420256,53.57142857143481,89.42857142856519,89.42857142857974,89.42857142856519,81.85714285714494,81.85714285714494,81.85714285714494,81.85714285713038,81.0,81.0,81.0,65.85714285714494,65.85714285714494,65.85714285714494,65.85714285714494,48.571428571420256,48.57142857143481,48.57142857143481,46.571428571420256,46.57142857143481,46.571428571420256,46.57142857143481,50.571428571420256,50.57142857143481,50.57142857143481,50.0,50.0,50.0,50.0,47.28571428571013,46.142857142855064,46.142857142855064,46.57142857143481,46.571428571420256,46.57142857143481,46.571428571420256,49.71428571428987,50.857142857144936,50.857142857144936,85.0,85.0,85.0,85.0,80.85714285714494,80.85714285714494,80.85714285713038,40.57142857143481,40.57142857143481,40.571428571420256,40.57142857143481,34.142857142855064,34.142857142855064,34.142857142855064,24.285714285710128,24.28571428572468,24.285714285710128,24.285714285710128,25.428571428579744,25.428571428565192,25.428571428579744,41.28571428571013,41.28571428571013,41.28571428571013,41.28571428572468,29.428571428565192,29.428571428579744,29.428571428565192,24.714285714289872,24.71428571427532,24.714285714289872,24.714285714289872,24.714285714289872,24.71428571427532,24.714285714289872,31.571428571434808,31.571428571420256,31.571428571434808,31.0,31.0,31.0,31.0,30.857142857144936,30.857142857130384,30.857142857144936,31.428571428579744,31.428571428565192,31.428571428579744,31.428571428565192,23.0,23.0,23.0,23.0,23.0,23.0,23.0,26.142857142855064,16.857142857144936,16.857142857144936,16.857142857144936,16.857142857144936,16.857142857130384,16.857142857144936,31.28571428572468,40.571428571420256,40.57142857143481,40.571428571420256,40.57142857143481,40.571428571420256,40.57142857143481,37.142857142855064,37.142857142855064,37.142857142855064,37.142857142869616,37.142857142855064,37.142857142855064,37.142857142855064,29.571428571434808,29.571428571420256,29.571428571434808,29.571428571420256,29.571428571434808,29.571428571420256,29.571428571434808,44.857142857144936,44.857142857144936,44.857142857144936,44.857142857130384,44.857142857144936,44.857142857144936,44.857142857144936,33.71428571428987,33.71428571427532,33.71428571428987,33.71428571428987,33.71428571428987,33.71428571427532,33.71428571428987,34.42857142856519,34.428571428579744,34.42857142856519,34.428571428579744,34.42857142856519,34.428571428579744,34.42857142856519,28.0,28.0,28.0,28.0,28.0,28.0,73.42857142856519,45.428571428579744,45.42857142856519,45.428571428579744,45.42857142856519,45.428571428579744,45.42857142856519,0.0,49.42857142856519,49.428571428579744,49.42857142856519,49.428571428579744,49.42857142856519,49.428571428579744,49.42857142856519,60.57142857143481,60.571428571420256,60.57142857143481,60.571428571420256,60.57142857143481,60.571428571420256,60.57142857143481,35.857142857144936,35.857142857144936,35.857142857144936,35.857142857130384,35.857142857144936,35.857142857144936,35.857142857144936,39.71428571428987,39.71428571427532,39.71428571428987,39.71428571428987,39.71428571428987,39.71428571427532,39.71428571428987,37.71428571428987,37.71428571427532,37.71428571428987,37.71428571428987,37.71428571428987,37.71428571427532,37.71428571428987,30.0,30.0,30.0,30.0,30.0,30.0,30.0,27.714285714289872,27.71428571427532,27.714285714289872,27.714285714289872,27.714285714289872,27.71428571427532,27.714285714289872,14.142857142855064,14.142857142855064,14.142857142855064,14.142857142869616,14.142857142855064,14.142857142855064,14.142857142855064,nan,nan,nan,nan,nan,nan,nan,nan,nan
fig, ax = plt.subplots(1, 3, figsize=(14, 8))
dldiff.plot(logy=False, lw=3, ax=ax[0])
dldiff.plot(logy=True, lw=3, ax=ax[1])
dldiff.tail(60).plot(logy=True, lw=3, ax=ax[2])
ax[0].set_ylim(0)
ax[0].set_title(
"Nombre de décès lissé sur 7 jours\npar jour après N jours"
"\ndepuis le début de l'épidémie")
tfdiff = ts_normalise_negative_values(tf.diff(), extreme=2).rolling(
7, center=False, win_type='triang').mean()
fig, ax = plt.subplots(1, 3, figsize=(14, 8))
tfdiff.plot(logy=False, lw=3, ax=ax[0])
tfdiff.plot(logy=True, lw=3, ax=ax[1])
tfdiff.tail(60).plot(logy=True, lw=3, ax=ax[2])
ax[0].set_ylim(0)
ax[0].set_title(
"Nombre de décès lissé sur 7 jours")
plt.show()
Total running time of the script: ( 0 minutes 28.305 seconds)