Geojson文件可用:以下代码未显示任何结果,这是什么问题?
!wget --quiet https://cocl.us/sanfran_geojson -O san_francisco_nh.json
print('GeoJSON file downloaded!')
sanfran_map.choropleth(
geo_data=sanfran_geo,
data=df_sf,
columns=['Neighborhood', 'Count'],
key_on='feature.properties.DISTRICT',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name="Crime Rate in San Francisco"
)
使用folium.Choropleth
和folium.LayerControl
:
import folium
m = folium.Map(location=[37.773972, -122.43],
zoom_start=10,
control_scale=True)
folium.Choropleth(geo_data=sanfran_geo,
name='choropleth',
data=df_sf,
columns=['Neighborhood', 'Count'],
key_on='feature.properties.DISTRICT',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Crime Rate in San Francisco').add_to(m)
folium.LayerControl().add_to(m)
m
(信誉不足,无法评论)
@句子
我尝试了您的代码(我知道Carlie正在从事的工作,并且我有这个
AttributeError: module 'folium' has no attribute 'Choropleth'
你有什么想法吗?