Exemplo n.º 1
0
def recap_world(dt, previous):
    previous = (pd.to_datetime(dt, dayfirst=True) -
                pd.to_datetime(previous, dayfirst=True)).days
    if dt == time.strftime('%d/%m/%Y'):
        dt = (datetime.now() - timedelta(1)).strftime('%d/%m/%Y')
    df_recap = GetData.get_recap_by_country(dt, previous=int(previous))
    df_confirmed = GetData.get_world('confirmed')
    confirmed = df_confirmed.iloc[:, -1].sum()
    confirmedp = df_recap['Cases (+)'].sum(axis=0)
    df_deaths = GetData.get_world('deaths')
    deaths = df_deaths.iloc[:, -1].sum()
    deathsp = df_recap['Deaths (+)'].sum(axis=0)
    df_recovered = GetData.get_world('recovered')
    recovered = df_recovered.iloc[:, -1].sum()
    recoveredp = df_recap['Recovered (+)'].sum(axis=0)
    france_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="France"]):,}'
    france_casesp2 = "{0}".format(france_casesp)
    us_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="US"]):,}'
    us_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="US"]):,}'
    france_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="France"]):,}'
    italy_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="Italy"]):,}'
    italy_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="Italy"]):,}'
    germany_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="Germany"]):,}'
    germany_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="Germany"]):,}'
    china_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="China"]):,}'
    china_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="China"]):,}'
    spain_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="Spain"]):,}'
    spain_casesp = f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="Spain"]):,}'
    return '{:,}'.format(confirmed),'(+ {:,})'.format(confirmedp),'{:,}'.format(deaths),'(+ {:,})'.format(deathsp),'{:,}'.format(recovered),'(+ {:,})'.format(recoveredp),\
        'Mise à jour le {} (+ Variations sur les {} derniers jours)'.format(pd.to_datetime(dt).strftime('%d/%m/%Y'),previous),'{:,}'.format(previous),'{:,}'.format(recoveredp),'{}'.format(france_casesp2),\
            '{}'.format(china_cases),'(+ {})'.format(china_casesp),'{}'.format(italy_cases),'(+ {})'.format(italy_casesp),'{}'.format(germany_cases),'(+ {})'.format(germany_casesp),\
                '{}'.format(spain_cases),'(+ {})'.format(spain_casesp),'{}'.format(us_cases),'(+ {})'.format(us_casesp),'{}'.format(france_cases),'(+ {})'.format(france_casesp2)
Exemplo n.º 2
0
def recap_table(dt=dt,previous=5):
    df_recap=GetData.get_recap_by_country(dt,previous=previous)
    columns = ['Pays','Nouveaux Cas','Total des cas','Total décès','Nouveau décès','Mortalité','Rétabli']
    df_H5=pd.DataFrame(columns=columns)
    df_H5["Pays"]=x = ['{0}'.format(i) for i in df_recap["Country/Region"]]
    df_H5["Total des cas"]=df_recap["Cases"]
    df_H5["Total décès"]=df_recap["Deaths"]
    df_H5["Mortalité"]=df_H5["Total décès"]/df_H5["Total des cas"]
    df_H5["Total décès"]=df_recap["Deaths"]
    df_H5["Rétabli"]=df_recap["Recovered"]
    df_H5["Nouveaux cas"]=[f'{i:,}'for i in df_recap["Cases (+)"]]
    df_H5["Nouveaux cas"]=["(+{0})".format(str(i)) for i in df_H5["Nouveaux cas"]]
    df_H5["Nouveau décès"]=[f'{i:,}'for i in df_recap['Deaths (+)']]
    df_H5["Nouveau décès"]=["(+{0})".format(str(i)) for i in df_H5["Nouveau décès"]]
    df_H5["Mortalité"]=["{:.2%}".format(i) for i in df_H5["Mortalité"]]
    df_H5["Rétabli"]=[f'{i:,}'for i in df_H5["Rétabli"]]
    df_H5["Total des cas"]=[f'{i:,}'for i in df_H5["Total des cas"]]
    df_H5["Total décès"]=[f'{i:,}'for i in df_H5["Total décès"]]
    rows =[]
    for index,row in df_H5.head(10).iterrows():
        rows.append(html.Tr([html.Td(row.Pays,style={'font-weight':'bold','text-align':'center'}),
        html.Td(row['Total des cas']),html.Td(row['Total décès']),html.Td(row['Mortalité'])],style={
            'border-bottom':'1px solid #e8e8e8'
        }))
    return [
        html.Thead([
            html.Tr(
                [
                    html.Th(
                    'COuntry',style={'text-align':'center','width':'180px'}
                    ),
                    html.Th(
                        'CASES',style ={
                            'text-align':'center',
                        }
                    ),
                    html.Th(
                        'DEATHS',style={
                            'text-align':'center',
                        }
                    ),
                    html.Th(
                        'MORTALITY',style={
                            'text-align':'center',
                        }
                    ),
                ],
                style = {
                    'border-bottom': '2px solid',
                    'text-transform':'uppercase',
                    "font-size":"14px"
                }
            )
        ]),
        html.Tbody(
            rows
        )
    ]
Exemplo n.º 3
0
def updatelabel3(valued,valuep): 
    
    previous=int(valuep)
    date=valued
    df_recap=GetData.get_recap_by_country(date,previous=previous)

    deathsp=df_recap['Deaths (+)'].sum(axis=0)
    
    france_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="France"]):,}'
    france_deathsp2="{0}".format(france_deathsp)
    
    return "In the last **{0}** days, **{1}** new Coronavirus deaths have been \
    reported worldwide. Of which **{2}** are from France.".format(\
    previous, deathsp, france_deathsp2)   
Exemplo n.º 4
0
def updatelabel2(valued,valuep):
    
    previous=int(valuep)
    date=valued
    df_recap=GetData.get_recap_by_country(date,previous=previous)
    
    #Récupération des cas confirmés

    confirmedp=df_recap['Cases (+)'].sum(axis=0)
    france_casesp=f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="France"]):,}'
    france_casesp2="{0}".format(france_casesp)  
    
    return "In the last **{0}** days, **{1}** new Coronavirus cases have been \
    reported worldwide. Of which **{2}** are from France.".format(\
    valuep, confirmedp, france_casesp2)
Exemplo n.º 5
0
def recap_table(dt, previous):
    previous = (pd.to_datetime(dt, dayfirst=True) -
                pd.to_datetime(previous, dayfirst=True)).days
    df_recap = GetData.get_recap_by_country(dt, previous=previous)
    columns = [
        'Pays', 'Nouveaux Cas', 'Total des cas', 'Total décès',
        'Nouveau décès', 'Mortalité', 'Rétabli'
    ]
    df_H5 = pd.DataFrame(columns=columns)
    df_H5["Pays"] = x = ['{0}'.format(i) for i in df_recap["Country/Region"]]
    df_H5["Total des cas"] = df_recap["Cases"]
    df_H5["Total décès"] = df_recap["Deaths"]
    df_H5["Mortalité"] = df_H5["Total décès"] / df_H5["Total des cas"]
    df_H5["Total décès"] = df_recap["Deaths"]
    df_H5["Rétabli"] = df_recap["Recovered"]
    df_H5["Nouveaux cas"] = [f'{i:,}' for i in df_recap["Cases (+)"]]
    df_H5["Nouveaux cas"] = [
        "(+{0})".format(str(i)) for i in df_H5["Nouveaux cas"]
    ]
    df_H5["Nouveau décès"] = [f'{i:,}' for i in df_recap['Deaths (+)']]
    df_H5["Nouveau décès"] = [
        "(+{0})".format(str(i)) for i in df_H5["Nouveau décès"]
    ]
    df_H5["Mortalité"] = ["{:.2%}".format(i) for i in df_H5["Mortalité"]]
    df_H5["Rétabli"] = [f'{i:,}' for i in df_H5["Rétabli"]]
    df_H5["Total des cas"] = [f'{i:,}' for i in df_H5["Total des cas"]]
    df_H5["Total décès"] = [f'{i:,}' for i in df_H5["Total décès"]]
    rows = []
    for index, row in df_H5.iterrows():
        rows.append(
            html.Tr([
                html.Td(row.Pays,
                        style={
                            'font-weight': 'bold',
                            'text-align': 'right'
                        }),
                html.Td(make_bars(row.Pays),
                        style={'vertical-align': 'middle'}),
                html.Td(row['Total des cas'], style={'font-weight': 'bolder'}),
                html.Td(row['Nouveaux cas'], style=CSS['danger']),
                html.Td(row['Total décès']),
                html.Td(row['Nouveau décès'], style=CSS['danger']),
                html.Td(row['Mortalité']),
                html.Td(row['Rétabli'])
            ],
                    style={'border-bottom': '1px solid #e8e8e8'}))
    return [
        html.Thead([
            html.Tr([
                html.Th(children='', style={'width': '150px'}),
                html.Th(
                    [
                        html.Div(children='10',
                                 style={
                                     "width": "27px",
                                     "height": "15px",
                                     "font-size": "8px"
                                 }),
                        html.Div(children='100',
                                 style={
                                     "width": "27px",
                                     "height": "15px",
                                     "font-size": "8px"
                                 }),
                        html.Div(children='1000',
                                 style={
                                     "width": "27px",
                                     "height": "15px",
                                     "font-size": "8px"
                                 }),
                    ],
                    style={
                        'width': '170px',
                        "height": "15px",
                        'vertical-align': 'middle',
                        "display": "flex",
                        "margin-left": "85px"
                    }),
                html.Th()
            ]),
            html.Tr([
                html.Th(children='', style={'width': '150px'}),
                html.Th(
                    [
                        html.Div(children='',
                                 style={
                                     "background": "rgba(255, 152, 0,0.1)",
                                     "width": "27px",
                                     "height": "15px"
                                 }),
                        html.Div(children='',
                                 style={
                                     "background": "rgba(255, 152, 0,0.4)",
                                     "width": "27px",
                                     "height": "15px"
                                 }),
                        html.Div(children='',
                                 style={
                                     "background": "rgba(255, 152, 0,0.7)",
                                     "width": "27px",
                                     "height": "15px"
                                 }),
                        html.Div(children='',
                                 style={
                                     "background": "rgba(255, 152, 1)",
                                     "width": "27px",
                                     "height": "15px"
                                 }),
                    ],
                    style={
                        'width': '170px',
                        "height": "15px",
                        'vertical-align': 'middle',
                        "display": "flex",
                        "margin-left": "50px"
                    }),
                html.Th()
            ]),
            html.Tr(
                [
                    html.Th('Pays',
                            style={
                                'text-align': 'right',
                                'width': '180px'
                            }),
                    html.Th('Evolution des cas',
                            style={
                                'text-align': 'center',
                                'width': '170px'
                            }),
                    html.Th('Total des cas',
                            style={
                                'text-align': 'center',
                                'width': '250px'
                            }),
                    html.Th('Nouveaux cas',
                            style={
                                'text-align': 'center',
                                'width': '250px'
                            }),
                    html.Th('Total décès',
                            style={
                                'text-align': 'center',
                                'width': '250px'
                            }),
                    html.Th('Nouveaux décès',
                            style={
                                'text-align': 'center',
                                'width': '300px'
                            }),
                    html.Th('Mortalité',
                            style={
                                'text-align': 'center',
                                'width': '200px'
                            }),
                    html.Th('Rétablis',
                            style={
                                'text-align': 'center',
                                'width': '200px'
                            })
                ],
                style={
                    'border-bottom': '2px solid',
                    'text-transform': 'uppercase',
                    "font-size": "14px"
                })
        ]),
        html.Tbody([
            html.Tr([
                html.Td(),
                html.Td(
                    [html.Div('22 Janvier'),
                     html.Div("Aujourd'hui")],
                    style={
                        'display': 'flex',
                        'justify-content': 'space-between',
                        'font-size': '9px'
                    }),
                html.Td(),
                html.Td('( + NOUVEAU ) depuis le {}'.format(
                    (pd.to_datetime(dt, dayfirst=True) -
                     timedelta(previous)).strftime('%d/%m/%Y')),
                        style={
                            "font-size": "9px",
                            'color': '#999',
                            'text-align': 'left'
                        }),
                html.Td(),
                html.Td()
            ])
        ] + rows)
    ]
Exemplo n.º 6
0
fig_dict['layout']['geo'] = dict(showland=True,
                                 landcolor="rgb(64, 64, 64)",
                                 showlakes=True,
                                 lakecolor="rgb(64, 64, 64)",
                                 showsubunits=True,
                                 subunitcolor="rgb(255, 255, 255)",
                                 showcountries=True,
                                 countrycolor="rgb(255, 255, 255)",
                                 showocean=True,
                                 oceancolor="rgb(255, 255, 255)",
                                 framecolor='rgb(255,255,255)')
fig2 = fig_dict

#DATA
dt = (datetime.now() - timedelta(1)).strftime('%d/%m/%Y')
df_recap = GetData.get_recap_by_country(dt, previous=5)
df_confirmed = GetData.get_world('confirmed')
confirmed = df_confirmed.iloc[:, -1].sum()
df_deaths = GetData.get_world('deaths')
deaths = df_deaths.iloc[:, -1].sum()
confirmedp = df_recap['Cases (+)'].sum(axis=0)
us_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="US"]):,}'
china_cases = f'{int(df_recap["Cases"][df_recap["Country/Region"]=="China"]):,}'
columns = [
    'Pays', 'Nouveaux Cas', 'Total des cas', 'Total décès', 'Nouveau décès',
    'Mortalité', 'Rétabli'
]
df_H5 = pd.DataFrame(columns=columns)
df_H5["Pays"] = x = ['{0}'.format(i) for i in df_recap["Country/Region"]]
df_H5["Total des cas"] = df_recap["Cases"]
df_H5["Total décès"] = df_recap["Deaths"]
Exemplo n.º 7
0
def updatefigure3(valued,valuep):
    previous=int(valuep)
    date=valued
    df_recap=GetData.get_recap_by_country(date,previous=previous)
    
    fill_color_H2='lightgray'
    line_color_H2='lightgray'
    font_color_H2=[['black','red']]
    font_size_H2=[12,11,11,11,11,11,11]
    
    columns_=["Country", "New Cases", "Total Cases","New Deaths","Total Deaths","Fatality", "Recovered"]
    columns_=['<b>{0}</b>'.format(i) for i in columns_]
    df_H5=pd.DataFrame(columns=["Country", "New Cases", "Total Cases","New Deaths","Total Deaths","Fatality", "Recovered"])

    
    df_H5["Country"]=x = ['<b>{0}</b>'.format(i) for i in df_recap["Country/Region"]]
    
    df_H5["Total Cases"]=df_recap["Cases"]
    
    df_H5["Total Deaths"]=df_recap["Deaths"]
    
    df_H5["Fatality"]=df_H5["Total Deaths"]/df_H5["Total Cases"]
    
    df_H5["Total Deaths"]=df_recap["Deaths"]
    
    df_H5["Recovered"]=df_recap["Recovered"]
    
    df_H5["New Cases"]=[f'{i:,}'for i in df_recap["Cases (+)"]]
    
    df_H5["New Cases"]=["(+{0})".format(str(i)) for i in df_H5["New Cases"]]
    
    df_H5["New Deaths"]=[f'{i:,}'for i in df_recap['Deaths (+)']]
    
    df_H5["New Deaths"]=["(+{0})".format(str(i)) for i in df_H5["New Deaths"]]
    
    df_H5["Fatality"]=["{:.2%}".format(i) for i in df_H5["Fatality"]]
    
    df_H5["Recovered"]=[f'{i:,}'for i in df_H5["Recovered"]]
    
    df_H5["Total Cases"]=[f'{i:,}'for i in df_H5["Total Cases"]]
    
    df_H5["Total Deaths"]=[f'{i:,}'for i in df_H5["Total Deaths"]]
    
    font_color_H5=['black','red','black','red','black','red','black']
    
    fig_H5 = go.Figure(go.Table(
        header=dict(values=list(columns_),
                    
                    align ='center', font=dict(color='black',size=12),
                    line_color=line_color_H2,
                    fill_color=fill_color_H2), 
                                
        cells=dict(values=[df_H5.Country, df_H5["New Cases"],df_H5["Total Cases"]\
                           , df_H5["New Deaths"], df_H5["Total Deaths"],\
                           df_H5.Fatality, df_H5.Recovered],
                   
                   font_size=font_size_H2,font_color=font_color_H5,
                   line_color=line_color_H2,fill_color=fill_color_H2)))
    
    
    fig_H5.update_layout(
        autosize=False,
        width=1000,
        height=400,
        margin=dict(
            l=300,
            r=20,
            b=100,
            t=50,
            pad=400
        ),
        title_text="<b>BY COUNTRY</b>",title_x=0.63,
       title_font_color='black'
    ) 
    return fig_H5
    
Exemplo n.º 8
0
def updatefigure3(valued,valuep):
    previous=int(valuep)
    date=valued
    df_recap=GetData.get_recap_by_country(date,previous=previous)
    
    fill_color_H2='lightgray'
    line_color_H2='lightgray'
    font_color_H2=[['black','red']]

    #USA  
    us_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="US"]):,}'
    us_deaths="<b>{0}</b>".format(us_deaths)
    
    us_casesp=f'{int(df_recap["Cases (+)"][df_recap["Country/Region"]=="US"]):,}'
    us_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="US"]):,}'
    us_casesp="<b>(+{0})</b>".format(us_casesp)
    us_deathsp="<b>(+{0})</b>".format(us_deathsp)
    
    #France
    france_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="France"]):,}'
    france_deaths="<b>{0}</b>".format(france_deaths)   

    france_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="France"]):,}'
    france_deathsp="<b>(+{0})</b>".format(france_deathsp)
    
    #Italy
    italy_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="Italy"]):,}'
    italy_deaths="<b>{0}</b>".format(italy_deaths)
    
    italy_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="Italy"]):,}'
    italy_deathsp="<b>(+{0})</b>".format(italy_deathsp)
    
    #Germany
    germany_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="Germany"]):,}'
    germany_deaths="<b>{0}</b>".format(germany_deaths)
    
    germany_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="Germany"]):,}'
    germany_deathsp="<b>(+{0})</b>".format(germany_deathsp)
    
    #China
    china_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="China"]):,}'
    china_deaths="<b>{0}</b>".format(china_deaths)
    
    china_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="China"]):,}'
    china_deathsp="<b>(+{0})</b>".format(china_deathsp)
    
    #Spain
    spain_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="Spain"]):,}'
    spain_deaths="<b>{0}</b>".format(spain_deaths)
    
    spain_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="Spain"]):,}'
    spain_deathsp="<b>(+{0})</b>".format(spain_deathsp)
    
    #Iran
    iran_deaths=f'{int(df_recap["Deaths"][df_recap["Country/Region"]=="Iran"]):,}'
    iran_deaths="<b>{0}</b>".format(iran_deaths)
    
    iran_deathsp=f'{int(df_recap["Deaths (+)"][df_recap["Country/Region"]=="Iran"]):,}'
    iran_deathsp="<b>(+{0})</b>".format(iran_deathsp)
    
    values_H4=[[china_deaths,china_deathsp],[france_deaths,france_deathsp],\
               [germany_deaths,germany_deathsp],[us_deaths,us_deathsp],\
               [spain_deaths,spain_deathsp], [iran_deaths,iran_deathsp],\
               [italy_deaths,italy_deathsp]]
    
    fig_H4= go.Figure(data=[go.Table(
      header=dict(values=["China","France", "Germany"\
                          ,"US","Spain","Iran"\
                          ,"Italy"]
        ,
        line_color=line_color_H2,fill_color=fill_color_H2,
        align='center',font=dict(color='black', size=10)
      ),
      cells=dict(
              line_color=line_color_H2,fill_color=fill_color_H2,font_color=font_color_H2,
        values=values_H4, font_size=13
        ))
    ])
    
    fig_H4.update_layout(
        autosize=False,
        width=1000,
        height=170,
        margin=dict(
            l=300,
            r=20,
            b=0,
            t=40,
            pad=20
        ),
        title_text="<b>DEATHS</b>",title_x=0.63,
       title_font_color='black'
    )                 
    return fig_H4
Exemplo n.º 9
0
def updatefigure1(valued,valuep):
    previous=int(valuep)
    date=valued
    df_recap=GetData.get_recap_by_country(date,previous=previous)
    
    #Récupération des cas confirmés
    df_confirmed=GetData.get_world('confirmed')
    confirmed=df_confirmed.iloc[:,5:].sum(axis=1).sum(axis=0)
    confirmedp=df_recap['Cases (+)'].sum(axis=0)
    #Récupération des cas morts
    df_deaths=GetData.get_world('deaths')
    deaths=df_deaths.iloc[:,5:].sum(axis=1).sum(axis=0)
    deathsp=df_recap['Deaths (+)'].sum(axis=0)
    #Récupération des cas guéris
    df_recovered=GetData.get_world('recovered')
    recovered=df_recovered.iloc[:,5:].sum(axis=1).sum(axis=0)
    recoveredp=df_recap['Recovered (+)'].sum(axis=0)   
    
    confirmed=f'{confirmed:,}'
    deaths=f'{deaths:,}'
    recovered=f'{recovered:,}'
    
    confirmedp=f'{confirmedp:,}'
    deathsp=f'{deathsp:,}'
    recoveredp=f'{recoveredp:,}'
    
    a="<b>{0}</b>".format(confirmed)
    b="<b>{0}</b>".format(deaths)
    c="<b>{0}</b>".format(recovered)
    
    e="<b>(+{0})</b>".format(confirmedp)
    f="<b>(+{0})</b>".format(deathsp)
    g="<b>(+{0})</b>".format(recoveredp)


    #CSS 
    fill_color_H2='lightgray'
    line_color_H2='lightgray'
    font_color_H2=[['black','red']]
    font_size_H2=[15]
    
    
    #layout = go.Layout( autosize=True, **margin={'l': 0, 'r': 0, 't': 20, 'b': 0}**)
    
    fig_H2= go.Figure(data=[go.Table(
      header=dict(values=["Confirmed Cases","Deaths", "Recovered"]
        ,
        line_color=line_color_H2,fill_color=fill_color_H2,
        align='center',font=dict(color='black', size=10)
      ),
      cells=dict(
        values=[[a,e],[b,f], [c,g]],align='center',
        line_color=line_color_H2,
        fill_color=fill_color_H2, font_color=font_color_H2, 
        font_size=font_size_H2
        
        ))
    ])
    fig_H2.update_layout(
        autosize=False,
        width=500,
        height=170,
        margin=dict(
            l=20,
            r=20,
            b=20,
            t=50,
            pad=10
        ),
        title_text="<b>WORLD</b>",title_x=0.5,
       title_font_color='black'
    )

    return fig_H2
Exemplo n.º 10
0
                href="/"),
            dbc.NavbarToggler(id="navbar-toggler2"),
            dbc.Nav(
                [
                    dbc.NavItem(dbc.NavLink("Récapitulatif",href="/")),
                    dbc.NavItem(dbc.NavLink("Simulateur",href="/simulation")),
                ],className="ml-auto",navbar=True
            )
            
        ],
    color="dark",
    dark=True,
)


df=GetData.get_recap_by_country("20/03/2020",10)


style_H1 ={"display": "block",
            "margin-left": "auto",
            "margin-right": "auto",'textAlign': 'center'}

style_label = {"display": "block",
            "margin-left": "auto",
            "margin-right": "auto",'textAlign': 'center', 'color':'black'}

style_phraseH5 = {'color': 'black', 'textAlign': 'center',\
               'margin-bottom':'0px','margin-top': '0px'  }

style_fig_H2={
            'height': 152,
Exemplo n.º 11
0
import plotly.graph_objects as go
from apps import GetData
import pandas as pd
import plotly.graph_objects as go
from plotly.colors import n_colors
import numpy as np
import chart_studio.plotly as py

#Récupération du récap
date = "20/03/2020"
previous = 5
df_recap = GetData.get_recap_by_country(date, previous=previous)

#Récupération des cas confirmés
df_confirmed = GetData.get_world('confirmed')
confirmed = df_confirmed.iloc[:, 5:].sum(axis=1).sum(axis=0)
confirmedp = df_recap['Cases (+)'].sum(axis=0)
#Récupération des cas morts
df_deaths = GetData.get_world('deaths')
deaths = df_deaths.iloc[:, 5:].sum(axis=1).sum(axis=0)
deathsp = df_recap['Deaths (+)'].sum(axis=0)
#Récupération des cas guéris
df_recovered = GetData.get_world('recovered')
recovered = df_recovered.iloc[:, 5:].sum(axis=1).sum(axis=0)
recoveredp = df_recap['Recovered (+)'].sum(axis=0)

df_H2 = pd.DataFrame([[confirmed, deaths, recovered]],
                     columns=["Confirmed Cases", "Deaths", "Recovered"])

confirmed = f'{confirmed:,}'
deaths = f'{deaths:,}'