round(df1.describe(), 4)
df1.isna().sum()
df2=df1.dropna(axis=1, how='all').fillna(df1.mean(numeric_only=True))
round(df2.describe(), 3)
sns.set_style("darkgrid")
fig, ax1 = plt.subplots()
color = 'tab:red'
ax1.set_xlabel('date')
ax1.set_ylabel('new tests smoothed', color=color)
ax1.tick_params(axis='x', rotation=55)
ax1.plot(t, data1, color=color)
ax1.tick_params(axis='y', labelcolor=color)
plt.text((650)*1.1, (300000)*0.95, 'Punto maximo', fontsize=10, color='Black')
plt.title('new deaths smoothed \n and new tests smoothed')
ax2 = ax1.twinx()
color = 'tab:blue'
ax2.set_ylabel('new deaths smoothed', color=color)
ax2.plot(t, data2, color=color)
ax2.tick_params(axis='y', labelcolor=color)
fig.tight_layout()
plt.xticks(range(1,992,40))
plt.xlim(600,1000)
ax1.plot(data1, label = "new tests smoothed")
ax1.plot(data2, label = "new deaths smoothed")
ax1.legend(["new tests smoothed","new deaths smoothed"])
plt.text((900), 20, 'Descenso', fontsize=10, color='Black')
plt.show()
sns.set_style("darkgrid")
fig, ax1 = plt.subplots()
color = 'tab:red'
ax1.set_xlabel('date')
ax1.set_ylabel('new tests smoothed', color=color)
ax1.tick_params(axis='x', rotation=55)
ax1.plot(t, data1, color=color)
ax1.tick_params(axis='y', labelcolor=color)
plt.title('new tests smoothed \n and tests used')
ax2 = ax1.twinx()
color = 'tab:blue'
ax2.set_ylabel('tests used', color=color)
ax2.plot(t, df3, color=color)
ax2.tick_params(axis='y', labelcolor=color)
fig.tight_layout()
plt.xticks(range(1,992,40))
plt.xlim(600,1000)
ax1.plot(data1, label = "new tests smoothed")
ax1.plot(df3, label = "tests used")
ax1.legend(["new tests smoothed","tests used"])
plt.show()
plt.hist(data3, orientation='horizontal', bins=30)
plt.xlabel('Frecuencia')
plt.ylabel('hosp patients per million')
plt.hist(data2, orientation='horizontal', bins=30)
plt.xlabel('Frecuencia')
plt.ylabel('new deaths smoothed')