Covid-19 in Italia

curl https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-json/dpc-covid19-ita-andamento-nazionale.json > data.json
curl https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv > data.csv
2.4s
Bash in Python

Dati

Dati incrementali

La situazione negli ospedali

Ricovero vs Isolamento domiciliare

plot_positive(data)
2.8s
Python

Terapia intensiva vs normale ricovero

plot_hospital(data)
1.2s
Python

Nuovi casi giornalieri

plot_variation(indata)
1.0s
Python

Media 7 giorni

plot_variation(rolling(indata,7))
0.9s
Python

Tamponi giornalieri e nuovi positivi

plot_tests(indata)
1.4s
Python

Media 7 giorni

plot_tests(rolling(indata,7))
1.2s
Python

Dati regionali

curl https://raw.githubusercontent.com/pcm-dpc/COVID-19/master/dati-regioni/dpc-covid19-ita-regioni.csv > data_region.csv
1.2s
Bash in Python
import pandas as pd
def extract_measure(measure):
  dr = pd.read_csv('data_region.csv')
  dr = dr.drop(['stato', 'lat', 'codice_regione', 'long', 'note'],axis=1)
  dr = dr[['data',measure,'denominazione_regione']]
  dr = dr.reset_index().pivot('data','denominazione_regione',measure)
  return dr
def plot_data(measure,last=0,window=1,incremental=False,log_scale=False):
  data = extract_measure(measure).reset_index()
  if incremental:
    data = incremental_data(data)
  if window > 1:
    data = rolling(data,window)
  if last > 0:
    data = data[-last:]
  fig =go.Figure(data=[
    go.Scatter(mode='lines',name='Lombardia', x=data['data'], y=data['Lombardia'], marker_color='black'),
    go.Scatter(mode='lines',name='Emilia-Romagna', x=data['data'], y=data['Emilia-Romagna'], marker_color='darkgreen'),
    go.Scatter(mode='lines',name='Sicilia', x=data['data'], y=data['Sicilia'], marker_color='gold'),
    go.Scatter(mode='lines',name='Veneto', x=data['data'], y=data['Veneto'], marker_color='deepskyblue'),
    go.Scatter(mode='lines',name='Piemonte', x=data['data'], y=data['Piemonte'], marker_color='brown'),
    go.Scatter(mode='lines',name='Marche', x=data['data'], y=data['Marche'], marker_color='orange'),
    go.Scatter(mode='lines',name='Toscana', x=data['data'], y=data['Toscana'], marker_color='chocolate'),
    go.Scatter(mode='lines',name='Lazio', x=data['data'], y=data['Lazio'], marker_color='red'),
    go.Scatter(mode='lines',name='Liguria', x=data['data'], y=data['Liguria'], marker_color='grey'),
    go.Scatter(mode='lines',name='Campania', x=data['data'], y=data['Campania'], marker_color='skyblue'),
    go.Scatter(mode='lines',name='Puglia', x=data['data'], y=data['Puglia'], marker_color='orchid'),
  ])
  if log_scale:
    fig.update_yaxes(type="log")
  return fig
#dr = pd.read_csv('data_region.csv')
#dr
0.2s
Python

Nuovi Positivi

plot_data('totale_casi',window=7,incremental=True,last=60)
1.1s
Python

Morti

plot_data('deceduti',window=7,incremental=True,last=60)
1.2s
Python

Nuovi ricoveri

plot_data('ricoverati_con_sintomi',window=7,incremental=True,last=60)
1.0s
Python

Terapie intensive

plot_data('terapia_intensiva',window=7,incremental=True,last=60)
1.2s
Python

Ingressi terapia intensiva

plot_data('ingressi_terapia_intensiva',window=1,incremental=False,last=14)
1.1s
Python

Tamponi

plot_data('tamponi',window=7,incremental=True,last=60)
1.4s
Python

Altre risorse (in inglese)

Runtimes (1)