-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
questionThe issue contains a question about how to do somethingThe issue contains a question about how to do something
Description
Please add a code sample or a nbviewer link, copy-pastable if possible
import pandas as pd
sf_crime = pd.read_csv('https://cocl.us/sanfran_crime_dataset')
sf_crime.drop(['IncidntNum', 'Category', 'Descript', 'DayOfWeek', 'Date', 'Time', 'Resolution', 'Address', 'X', 'Y', 'Location', 'PdId'], axis=1, inplace=True)
by_zone = sf_crime.apply(pd.Series.value_counts).reset_index()
by_zone.rename(columns={'index':'Neighborhood', 'PdDistrict':'Count'}, inplace=True)
!wget --quiet https://cocl.us/sanfran_geojson -O sf_neighborhoods.json
sf_zones = r'sf_neighborhoods.json'
!pip install folium==0.5.0
sf_lat = 37.77
sf_lon = -122.42
sf_crime_map = folium.Map(location=[sf_lat, sf_lon],
zoom_start=12,
tiles='Mapbox Bright')
sf_crime_map.choropleth(
geo_data=sf_zones,
data=by_zone,
columns=['Neighborhood', 'Count'],
key_on='feature.properties.name',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='San Fransisco Crime by Neighborhood'
)
sf_crime_mapProblem description
The above code is used in a Jupyter notebook, and generates a map, but the map doesn't not show the any colors corresponding to the number of crimes in each SF neighborhood.
Expected Output
Output of folium.__version__
A map
Metadata
Metadata
Assignees
Labels
questionThe issue contains a question about how to do somethingThe issue contains a question about how to do something