Python 与我的choropleth申报箱斗争=10,没有箱子
我有以下代码:Python 与我的choropleth申报箱斗争=10,没有箱子,python,folium,choropleth,Python,Folium,Choropleth,我有以下代码: world_map = folium.Map(location=[37.759308, -122.438632], zoom_start=12, tiles='Mapbox Bright') world_map.choropleth( geo_data = san_fran_hoods, data = df_hoods, columns=['Neighborhood', 'Count'], key_on='features.properties.D
world_map = folium.Map(location=[37.759308, -122.438632], zoom_start=12, tiles='Mapbox Bright')
world_map.choropleth(
geo_data = san_fran_hoods,
data = df_hoods,
columns=['Neighborhood', 'Count'],
key_on='features.properties.DISTRICT',
bins=10,
threshold_scale=threshold_scale,
fill_color='YlOrRd',
fill_opacity=0.7,
line_opacity=0.2,
legend_name='Crime Rate in San Francisco')
world_map
当我使用bins=10声明运行它时,我得到以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-48-02ceaa998675> in <module>
11 fill_opacity=0.7,
12 line_opacity=0.2,
---> 13 legend_name='Crime Rate in San Francisco')
14 world_map
TypeError: choropleth() got an unexpected keyword argument 'bins'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-49-0767317c1b31> in <module>
10 fill_opacity=0.7,
11 line_opacity=0.2,
---> 12 legend_name='Crime Rate in San Francisco')
13 world_map
~/conda/envs/python/lib/python3.6/site-packages/folium/folium.py in choropleth(self, geo_data, data, columns, key_on, threshold_scale, fill_color, fill_opacity, line_color, line_weight, line_opacity, name, legend_name, topojson, reset, smooth_factor, highlight)
242 """
243 if threshold_scale and len(threshold_scale) > 6:
--> 244 raise ValueError
245 if data is not None and not color_brewer(fill_color):
246 raise ValueError('Please pass a valid color brewer code to '
ValueError:
---------------------------------------------------------------------------
TypeError回溯(最近一次调用上次)
在里面
11填充不透明度=0.7,
12线不透明度=0.2,
--->13图例(旧金山的犯罪率)
14世界地图
TypeError:choropleth()获得意外的关键字参数“bins”
当我删除bins=10声明时,我得到以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-48-02ceaa998675> in <module>
11 fill_opacity=0.7,
12 line_opacity=0.2,
---> 13 legend_name='Crime Rate in San Francisco')
14 world_map
TypeError: choropleth() got an unexpected keyword argument 'bins'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-49-0767317c1b31> in <module>
10 fill_opacity=0.7,
11 line_opacity=0.2,
---> 12 legend_name='Crime Rate in San Francisco')
13 world_map
~/conda/envs/python/lib/python3.6/site-packages/folium/folium.py in choropleth(self, geo_data, data, columns, key_on, threshold_scale, fill_color, fill_opacity, line_color, line_weight, line_opacity, name, legend_name, topojson, reset, smooth_factor, highlight)
242 """
243 if threshold_scale and len(threshold_scale) > 6:
--> 244 raise ValueError
245 if data is not None and not color_brewer(fill_color):
246 raise ValueError('Please pass a valid color brewer code to '
ValueError:
---------------------------------------------------------------------------
ValueError回溯(最近一次调用上次)
在里面
10填充不透明度=0.7,
11线不透明度=0.2,
--->12图例(旧金山的犯罪率)
13世界地图
choropleth中的~/conda/envs/python/lib/python3.6/site-packages/folium/folium.py(self、geo\u数据、数据、列、按键、阈值、填充颜色、填充不透明度、线条颜色、线条权重、线条不透明度、名称、图例名称、topojson、重置、平滑因子、高亮显示)
242 """
243如果阈值刻度和len(阈值刻度)>6:
-->244升值错误
245如果数据不是无且不是颜色(填充颜色):
246 raise VALUE ERROR('请将有效的彩色啤酒厂代码传递给'
值错误:
这似乎是由于色阶和色阶(色阶)大于6,并且我没有有效的彩色布鲁尔代码造成的…但我正在使用我们需要使用的代码。是否有更新的彩色布鲁尔代码?对于folium 0.11.0,我找到了一个列为YlOrRd\u 06的颜色布鲁尔代码,并尝试了该代码,但运气不佳