Example #1
0
len(kiva_country)
kiva_hdi = hdi[hdi['Country'].apply(lambda c: c in kiva_country)]
kiva_hdi['Country'].apply(lambda c: c in kiva_country)

# ### HDI:

# In[43]:

m = folium.Map(location=[0, 0], zoom_start=2)

m.choropleth(
    geo_data=geo_world_data,
    data=hdi,
    columns=['Country', 'HDI'],
    key_on='feature.properties.name',
    name='HDI',
    fill_opacity=1,
    fill_color='GnBu',
    highlight=True,
    #threshold_scale=[100,1000,2000,4000,6000,10000],
    legend_name='HDI')
folium.LayerControl().add_to(m)
m

# Human Development Index (HDI):
# A composite index measuring average achievement in three basic dimensions of human development
# 1. A long and healthy life: is assessed by life expectancy at birth
# 2. Knowledge or Education: is mean year of schooling for adults
# 3. A decent standard of living: is Gross National Income per capita
#
# It does not reflect on inequalities, poverty, human security, empowerment, etc.
Example #2
0
# In[64]:

# group_state
m = folium.Map(location=[37, -102], zoom_start=4)

folium.TileLayer('CartoDB positron', name="Light Map", control=False).add_to(m)

# myscale = (state_map['Count'].quantile((0,0.2,0.4,0.6,0.8,1))).tolist()

m.choropleth(
    geo_data=state_map,
    name='Choropleth',
    data=state_map,
    columns=['State', 'Count'],
    key_on="feature.properties.State",
    fill_color='YlGnBu',
    #     threshold_scale=myscale,
    fill_opacity=1,
    line_opacity=0.2,
    legend_name='Count of Accidents',
    smooth_factor=0)

style_function = lambda x: {
    'fillColor': '#ffffff',
    'color': '#000000',
    'fillOpacity': 0.1,
    'weight': 0.1
}
highlight_function = lambda x: {
    'fillColor': '#000000',
    'color': '#000000',