1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
import pandas as pd
import io
import requests
import numpy as np
from matplotlib import pyplot as plt
from datetime import date, timedelta
url_CC = "https://epistat.sciensano.be/Data/COVID19BE_CASES_AGESEX.csv"
s_CC = requests.get(url_CC).content
df_CC = pd.read_csv(io.StringIO(s_CC.decode('iso_8859_1')))
df_CC['REGION'] = df_CC['REGION'].astype(str)
liste_dates = df_CC['DATE'].values
liste_dates= liste_dates.astype(str)
liste_dates = list(set(liste_dates))
liste_dates.sort()
len_liste_dates = len(liste_dates)
Bruxelles_CC=[0 for i in range(len_liste_dates)]
Wallonie_CC=[0 for i in range(len_liste_dates)]
Flandre_CC=[0 for i in range(len_liste_dates)]
for i in range(0,len(df_CC)):
if df_CC.iloc[i,2] == "Brussels":
position = liste_dates.index(df_CC.iloc[i,0])
Bruxelles_CC[position]=Bruxelles_CC[position] + df_CC.iloc[i,5]
if df_CC.iloc[i,2] == "Flanders":
position = liste_dates.index(df_CC.iloc[i,0])
Flandre_CC[position]=Flandre_CC[position] + df_CC.iloc[i,5]
if df_CC.iloc[i,2] == "Wallonia":
position = liste_dates.index(df_CC.iloc[i,0])
Wallonie_CC[position]=Wallonie_CC[position] + df_CC.iloc[i,5]
Bruxelles_cumul_CC=np.cumsum(Bruxelles_CC)
Flandre_cumul_CC=np.cumsum(Flandre_CC)
Wallonie_cumul_CC=np.cumsum(Wallonie_CC)
Belgique_cumul_CC = list(map(sum, zip(Bruxelles_cumul_CC,Wallonie_cumul_CC,Flandre_cumul_CC))) |
Partager