我无法从带有位置数据的数据框中可视化地图
我有一个从foursquare数据的json文件创建的数据框,我正试图可视化提取的位置,但我面临着显示地图的挑战。下面是代码和我面临的错误
soweto_map = folium.Map(location=[soweto_latitude, soweto_longitude],
zoom_start=11) # generate the Soweto map
# add Ecco as a red circle mark
folium.features.CircleMarker(
[soweto_latitude, soweto_longitude],
radius=10,
popup=label,
fill=True,
color='red',
fill_color='red',
fill_opacity=0.6
).add_to(soweto_map)
# add popular spots to the map as blue circle markers
for lat, lng, label in zip(sodataframe.lat, sodataframe.lng,
sodataframe.categories):
folium.features.CircleMarker(
[lat, lng],
radius=5,
popup=label,
fill=True,
color='blue',
fill_color='blue',
fill_opacity=0.6
).add_to(soweto_map)
# display map
soweto_map
AttributeError Traceback (most recent call
last)
<ipython-input-148-c40af89cf70e> in <module>
9 color='red',
10 fill_color='red',
---> 11 fill_opacity=0.6
12 ).add_to(soweto_map)
13
~/conda/envs/python/lib/python3.6/site-packages/folium/features.py in
__init__(self, location, radius, popup, **kw)
868 """
869 def __init__(self, location, radius=10, popup=None, **kw):
--> 870 super(CircleMarker, self).__init__(location=location,
popup=popup)
871 self._name = 'CircleMarker'
872 options = _parse_path(**kw)
~/conda/envs/python/lib/python3.6/site-packages/folium/map.py in
__init__(self, location, popup, icon)
651 self.add_child(Popup(popup))
652 elif popup is not None:
--> 653 self.add_child(popup)
654
655 self._template = Template(u"""
~/conda/envs/python/lib/python3.6/site-packages/branca/element.py in
add_child(self, child, name, index)
106 """Add a child."""
107 if name is None:
--> 108 name = child.get_name()
109 if index is None:
110 self._children[name] = child
AttributeError: 'list' object has no attribute 'get_name'
目前没有回答
相关问题 更多 >
编程相关推荐