In [2]:
# Librerie
import os
import pandas as pd
import numpy as np
import folium
import matplotlib.pyplot as plt
plt.style.use('ggplot')
get_ipython().magic('pylab inline')
In [3]:
# Cartelle Input/Output
dir_df = os.path.join(os.path.abspath(''),'stg')
dir_out = os.path.join(os.path.abspath(''),'output')
In [4]:
df_g2_filename = r'df_g2.pkl'
df_g2_fullpath = os.path.join(dir_df, df_g2_filename)
df_g2 = pd.read_pickle(df_g2_fullpath)
In [6]:
df_g2 = df_g2[df_g2['Territorio']!='Italia']
In [8]:
df_g2['Popolazione'] = df_g2['Popolazione']/100000
In [12]:
# Report G2
tp = df_g2.plot(
x='Reddito pro capite',
y='Gradio di soddisfazione per la vita',
s=df_g2['Popolazione'],
kind='scatter',
xlim=(0,75000),
ylim=(0,10),
legend = False)
for i, txt in enumerate(df_g2.Territorio):
tp.annotate(txt, (df_g2['Reddito pro capite'].iat[i]*1.070,df_g2['Gradio di soddisfazione per la vita'].iat[i]))
tp.plot()
fig_prj = tp.get_figure()
fig_prj.tight_layout()
fig_prj.savefig(os.path.join(dir_out,'g2.png'), format='png', dpi=300)