无法使用我的代码获取 Choropleth 地图:请指导谢谢
Unable to get Choropleth Map using my code: Please guide Thanks
我收到此错误:已弃用等值线法。而是使用具有相同参数的新 Choropleth class。请参阅示例笔记本 'GeoJSON_and_choropleth' 了解如何执行此操作。
with open('C:/Users/abcdef/Desktop/world_countries.json') as data_file:
data = json.load(data_file)
world_geo = data
world_map = folium.Map(location=[0, 0], zoom_start=2, tiles = 'Mapbox Bright')
world_map.choropleth(
geo_data = world_geo,
data = canadamap,
columns = ['Country', 'Total'],
key_on = 'feature.properties.name',
fill_color = 'YlOrRd',
fill_opacity = 0.7,
line_opacity = 0.2,
legend_name = 'Immigration to Canada'
)
world_map
我没有使用上面的代码得到 Choropleth 地图;相反,我得到
The choropleth method has been deprecated. Instead use the new Choropleth class, which has the same arguments. See the example notebook 'GeoJSON_and_choropleth' for how to do this.
这应该适合你。该方法已修改为 Choropleth 而不是 Choropleth。
你应该
folium.Choropleth(args*).add_to(world_map)
一共
world_geo = r'world_countries.json' # geojson file
# create a plain world map
world_map = folium.Map(location=[0, 0], zoom_start=2, tiles='Mapbox Bright')
# generate choropleth map using the total immigration of each country to Canada from 1980 to 2013
folium.Choropleth(
geo_data=world_geo,
data=df_can,
columns=['Country', 'Total'],
key_on='feature.properties.name',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Immigration to Canada'
).add_to(world_map)
# display map
world_map
希望对您有所帮助
我收到此错误:已弃用等值线法。而是使用具有相同参数的新 Choropleth class。请参阅示例笔记本 'GeoJSON_and_choropleth' 了解如何执行此操作。
with open('C:/Users/abcdef/Desktop/world_countries.json') as data_file:
data = json.load(data_file)
world_geo = data
world_map = folium.Map(location=[0, 0], zoom_start=2, tiles = 'Mapbox Bright')
world_map.choropleth(
geo_data = world_geo,
data = canadamap,
columns = ['Country', 'Total'],
key_on = 'feature.properties.name',
fill_color = 'YlOrRd',
fill_opacity = 0.7,
line_opacity = 0.2,
legend_name = 'Immigration to Canada'
)
world_map
我没有使用上面的代码得到 Choropleth 地图;相反,我得到
The choropleth method has been deprecated. Instead use the new Choropleth class, which has the same arguments. See the example notebook 'GeoJSON_and_choropleth' for how to do this.
这应该适合你。该方法已修改为 Choropleth 而不是 Choropleth。 你应该
folium.Choropleth(args*).add_to(world_map)
一共
world_geo = r'world_countries.json' # geojson file
# create a plain world map
world_map = folium.Map(location=[0, 0], zoom_start=2, tiles='Mapbox Bright')
# generate choropleth map using the total immigration of each country to Canada from 1980 to 2013
folium.Choropleth(
geo_data=world_geo,
data=df_can,
columns=['Country', 'Total'],
key_on='feature.properties.name',
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Immigration to Canada'
).add_to(world_map)
# display map
world_map
希望对您有所帮助