Python 中的等值线图
Choropleth maps in Python
这是我的数据集:
这是我的代码:
我收到这个错误:
需要代码的人:
canada_geo = r'canada_provinces.json'
# create a plain world map
canada_map = folium.Map(location=[56.1304, -106.3468], zoom_start=2, tiles='Mapbox Bright')
print(canada_geo)`
canada_map.choropleth(
geo_data=canada_geo,
data=canada,
columns=['abbreviation', 'Population'],
key_on="features.properties.Abbreviation",
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Population'
)
# display map
canada_map
错误在这一行:
key_on="features.properties.Abbreviation",
正确的代码是:
key_on="feature.properties.Abbreviation",
你得到:
这是我的数据集:
这是我的代码:
我收到这个错误:
需要代码的人:
canada_geo = r'canada_provinces.json'
# create a plain world map
canada_map = folium.Map(location=[56.1304, -106.3468], zoom_start=2, tiles='Mapbox Bright')
print(canada_geo)`
canada_map.choropleth(
geo_data=canada_geo,
data=canada,
columns=['abbreviation', 'Population'],
key_on="features.properties.Abbreviation",
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Population'
)
# display map
canada_map
错误在这一行:
key_on="features.properties.Abbreviation",
正确的代码是:
key_on="feature.properties.Abbreviation",
你得到: