我正在尝试使用 Folium 创建一个 choropleth,但是我遇到了上面提到的错误。这是我的数据框:这是我的“任务”区的 GeoJSON 片段:...{ "type": "Feature", "properties": { "OBJECTID": 4, "DISTRICT": "MISSION", "COMPANY": "D" }, "geometry": { "type": "Polygon", "coordinates": [ [...这是我创建等值线的尝试:world_map.choropleth( geo_data=world_geo, name='choropleth', data=dc, columns=['Neighborhood', 'Count'], key_on='feature.properties.DISTRICT',# color='YlOrRd',# fill_opacity=0.7,# line_opacity=0.5 )这是它抛出的错误:---------------------------------------------------------------------------ValueError Traceback (most recent call last)<ipython-input-217-80d58334d627> in <module> 4 data=dc, 5 columns=['Neighborhood', 'Count'],----> 6 key_on='feature.properties.DISTRICT', 7 # color='YlOrRd', 8 # fill_opacity=0.7,/opt/conda/envs/Python36/lib/python3.6/site-packages/folium/folium.py in choropleth(self, *args, **kwargs) 416 ) 417 from folium.features import Choropleth--> 418 self.add_child(Choropleth(*args, **kwargs)) 419 420 def keep_in_front(self, *args):/opt/conda/envs/Python36/lib/python3.6/site-packages/folium/features.py in __init__(self, geo_data, data, columns, key_on, bins, fill_color, nan_fill_color, fill_opacity, nan_fill_opacity, line_color, line_weight, line_opacity, name, legend_name, overlay, control, show, topojson, smooth_factor, highlight, **kwargs) 1046 self._name = 'Choropleth' 1047 -> 1048 if data is not None and not color_brewer(fill_color): 1049 raise ValueError('Please pass a valid color brewer code to ' 1050 'fill_local. See docstring for valid codes.')请帮帮我。
1 回答
萧十郎
TA贡献1815条经验 获得超13个赞
如您所见,基本代码中没有blue
,但folium.features.Choroplethfill_color
中的默认参数是“蓝色”。
尝试通过在创建 choropleth 时Blues
添加参数来将其更改为类似的东西,看看是否有变化fill_color = "Blues"
添加回答
举报
0/150
提交
取消