<jupyter_start><jupyter_text>COVID-19 Andamento Nazionale<jupyter_code>import numpy as np
import pandas as pd
import shutil
import seaborn as sns
import os
import matplotlib.dates as dates
from pathlib import Path, PosixPath
import matplotlib.pyplot as plt

%matplotlib inline
sns.set()
# Per rimuovere la griglia dal grafico
# sns.set_style("white")<jupyter_output><empty_output><jupyter_text>Download data<jupyter_code>dirpath = os.path.join('COVID-19')
if os.path.exists(dirpath) and os.path.isdir(dirpath):
    shutil.rmtree(dirpath)

!git clone https://github.com/pcm-dpc/COVID-19.git<jupyter_output>Cloning into 'COVID-19'...
remote: Enumerating objects: 87, done.[K
remote: Counting objects: 100% (87/87), done.[K
remote: Compressing objects: 100% (43/43), done.[K
remote: Total 10888 (delta 56), reused 60 (delta 44), pack-reused 10801[K
Receiving objects: 100% (10888/10888), 275.80 MiB | 9.41 MiB/s, done.
Resolving deltas: 100% (8716/8716), done.
Updating files: 100% (1914/1914), done.<jupyter_text>Read data<jupyter_code># Nazionale
country_df = pd.read_csv('./COVID-19/dati-andamento-nazionale/dpc-covid19-ita-andamento-nazionale.csv', index_col='data', parse_dates=True)
# Regionale
regione = 'Piemonte'
country_df = pd.read_csv('./COVID-19/dati-regioni/dpc-covid19-ita-regioni.csv', index_col='data', parse_dates=True)
group = country_df.groupby('denominazione_regione')['denominazione_regione'].count()
country_df = country_df.loc[country_df['denominazione_regione'] == regione]
country_df.drop(['stato', 'note'], axis=1, inplace=True)
country_df.tail()
fig, axes = plt.subplots(nrows=1,ncols=2,figsize=(12,4))

country_df['nuovi_positivi'].plot.hist(bins=10, ax=axes[0], title='Nuovi positivi')
country_df['terapia_intensiva'].plot.hist(bins=10, ax=axes[1], title='Terapia intensiva')

plt.tight_layout()
#country_df.plot.area(alpha=0.4, figsize=(20,10),stacked=False)
country_df[['ricoverati_con_sintomi', 'terapia_intensiva', 'deceduti']].plot.area(alpha=0.4, figsize=(20,10),stacked=False)
country_df.plot.scatter(x='tamponi',y='totale_casi', figsize=(12,4))
#country_df['totale_positivi'].plot(figsize=(12,5))


fig, ax = plt.subplots(figsize=(12,5))
ax.plot_date(country_df.index, country_df['totale_positivi'],'-')

# Grids
ax.yaxis.grid(True)
ax.xaxis.grid(True)

# Major Axis
ax.xaxis.set_major_locator(dates.WeekdayLocator())
ax.xaxis.set_major_formatter(dates.DateFormatter('%d-%B'))

fig.autofmt_xdate() # Auto fixes the overlap!
plt.tight_layout()<jupyter_output><empty_output><jupyter_text>Variazione del totale di positivi (il numero deve diventare negativo)<jupyter_code>country_df['variazione_totale_positivi'].plot(figsize=(12,5))<jupyter_output><empty_output><jupyter_text>Nuove persone positive<jupyter_code>country_df['nuovi_positivi'].tail()
fig = country_df['nuovi_positivi'].plot(figsize=(12,5))
#plt.savefig('nuovi_positivi_lombardia.png')<jupyter_output><empty_output><jupyter_text>Tamponi<jupyter_code>country_df['tamponi'].plot(figsize=(12,5))<jupyter_output><empty_output><jupyter_text>Incremento giornaliero di tamponi<jupyter_code>country_df['daily_tamponi'] = country_df['tamponi'] - country_df['tamponi'].shift(1)
country_df['daily_tamponi'].plot(figsize=(12,5))
tamponi_df = country_df[['daily_tamponi','nuovi_positivi']]
tamponi_df.loc['2020-04-27':'2020-05-10'].plot.bar(stacked=True, figsize=(16,3),color=['r','b']);
tamponi_df.loc['2020-09-27':'2020-10-07'].plot.bar(stacked=True, figsize=(16,3),color=['r','b']);<jupyter_output><empty_output><jupyter_text>Nuovi positivi in relaziona ai tamponi fatti<jupyter_code>#country_df.head()
country_df['normed tamponi'] = country_df['nuovi_positivi'] / country_df['daily_tamponi']
country_df['normed tamponi'].plot(figsize=(12,5))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1661350345560872, 'fraction_numerical': 0.04731525784157363, 'mean_word_length': 9.395027624309392, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '170573', 'license': 'MIT', 'n_tokens_mistral': 1645, 'n_tokens_neox': 1497, 'n_words': 200, 'path': 'Andamento.ipynb', 'repo_name': 'marcocaldera/covid19', 'size': '3762'}