In [12]:
# Librerie
import os
import pandas as pd
import numpy as np
import folium
import matplotlib.pyplot as plt
plt.style.use('ggplot')
%pylab inline
In [13]:
# Cartelle Input/Output
dir_df = os.path.join(os.path.abspath(''),'stg')
dir_out = os.path.join(os.path.abspath(''),'output')
In [14]:
df_reg_filename = r'df_reg.pkl'
df_reg_fullpath = os.path.join(dir_df, df_reg_filename)
df_reg = pd.read_pickle(df_reg_fullpath)
In [4]:
df_reg.sum()
Out[4]:
In [5]:
regioni_geo_filename = r'regioni.geojson'
regioni_geo = os.path.join(dir_df, regioni_geo_filename)
reg_map = folium.Map(location=[42, 12], zoom_start=5)
reg_map.choropleth(geo_path=regioni_geo, data=df_reg,
columns=['Territorio', 'Value'],
key_on='feature.properties.NOME_REG',
fill_color='YlOrRd')
reg_map.save(os.path.join(dir_out,r'omicidi_volontari.html'))
reg_map
Out[5]: