<jupyter_start><jupyter_text>G2 - Grado di soddisfazione della vita<jupyter_code># 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')
# Cartelle Input/Output
dir_df = os.path.join(os.path.abspath(''),'stg')
dir_out = os.path.join(os.path.abspath(''),'output')
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)
df_g2 = df_g2[df_g2['Territorio']!='Italia']
df_g2['Popolazione'] = df_g2['Popolazione']/100000
# 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)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15584415584415584, 'fraction_numerical': 0.0354978354978355, 'mean_word_length': 4.868020304568528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '240044', 'license': 'Apache-2.0', 'n_tokens_mistral': 507, 'n_tokens_neox': 488, 'n_words': 83, 'path': '.ipynb_checkpoints/G2_data_visualization-checkpoint.ipynb', 'repo_name': 'Cesaaar/od_la_grande_fuga', 'size': '1155'}