I have a problem making this choroepth map. The areas are right, i got the numbers correct, but it fills my areas with the same color. My assumption is that I am getting the key_on wrong. My code is based on this tutorial: https://blog.dominodatalab.com/creating-interactive-crime-maps-with-folium/ Code:
[district_geo = r'C:/1/sfpddists.geojson'
SF = (37.783087441092704, -122.46120747577555)
crimedata2 = pd.DataFrame(df\['Police District'\].value_counts().astype(float))
crimedata2.to_json('crimeagg.json')
crimedata2 = crimedata2.reset_index()
crimedata2.columns = \['District', 'Number'\]
m = folium.Map(location=SF, zoom_start=12)
folium.GeoJson(
district_geo,
name='geojson'
).add_to(m)
m.choropleth(geo_data=r'C:/1/sfpddists.geojson', data=crimedata2,
columns=\['District', 'Number'\],
key_on=None,
fill_color = 'PuBu',
fill_opacity = 0.7,
line_opacity = 0.2,
highlight=True,
legend_name = 'Number of incidents per district')
m][1]