Я пытаюсь создать хороплет с помощью Folium, но я сталкиваюсь с ошибкой, упомянутой выше. Вот мой фрейм данных:
Вот мой фрагмент Geo JSON для района 'MISSION':
...{
"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.')
/opt/conda/envs/Python36/lib/python3.6/site-packages/branca/utilities.py in color_brewer(color_code, n)
147
148 if base_code not in core_schemes:
--> 149 raise ValueError(base_code + ' is not a valid ColorBrewer code')
150
151 try:
ValueError: blue is not a valid ColorBrewer code
Пожалуйста, помогите мне.