Last active
March 15, 2020 09:39
-
-
Save mashhadazam/c7f64dd49dd36b164986c99ee8e47b92 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Get totals for all metrics | |
GlobalTotals=CountryConsolidated.reset_index().groupby('Date').sum() | |
GlobalTotals['Share of Recoveries - Closed Cases']=np.round(GlobalTotals['Total Recoveries']/(GlobalTotals['Total Recoveries']+GlobalTotals['Total Deaths']),2) | |
GlobalTotals['Death to Cases Ratio']=np.round(GlobalTotals['Total Deaths']/GlobalTotals['Total Confirmed Cases'],3) | |
GlobalTotals.tail(2) | |
# Create Plots that show Key Metrics For the Covid-19 | |
chartcol='red' | |
fig = make_subplots(rows=3, cols=2,shared_xaxes=True, | |
specs=[[{}, {}],[{},{}], | |
[{"colspan": 2}, None]], | |
subplot_titles=('Total Confirmed Cases','Active Cases','Deaths','Recoveries','Death to Cases Ratio')) | |
fig.add_trace(go.Scatter(x=GlobalTotals.index,y=GlobalTotals['Total Confirmed Cases'], | |
mode='lines+markers', | |
name='Confirmed Cases', | |
line=dict(color=chartcol,width=2)), | |
row=1,col=1) | |
fig.add_trace(go.Scatter(x=GlobalTotals.index,y=GlobalTotals['Active Cases'], | |
mode='lines+markers', | |
name='Active Cases', | |
line=dict(color=chartcol,width=2)), | |
row=1,col=2) | |
fig.add_trace(go.Scatter(x=GlobalTotals.index,y=GlobalTotals['Total Deaths'], | |
mode='lines+markers', | |
name='Deaths', | |
line=dict(color=chartcol,width=2)), | |
row=2,col=1) | |
fig.add_trace(go.Scatter(x=GlobalTotals.index,y=GlobalTotals['Total Recoveries'], | |
mode='lines+markers', | |
name='Recoveries', | |
line=dict(color=chartcol,width=2)), | |
row=2,col=2) | |
fig.add_trace(go.Scatter(x=GlobalTotals.index,y=GlobalTotals['Death to Cases Ratio'], | |
mode='lines+markers', | |
line=dict(color=chartcol,width=2)), | |
row=3,col=1) | |
fig.update_layout(showlegend=False) |
I can't find GlobalTotals either. Can you post an update?
Thanks in advance!
Thanks for pointing out. I have updated it now!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
looks like the definition of
GlobalTotals
is missing?