AttributeError的:“地图”对象有没有属性“circle_marker”
我应该如何解决这个问题?基本上,我想根据他们的地理信息创建推文地图。所有我收集到的鸣叫是在美国境内,也有地理信息。AttributeError的:“地图”对象有没有属性“circle_marker”
Traceback (most recent call last): File "tweet_map.py", line 19, in <module>
tweet_map.circle_marker(location=geo, radius=250)
AttributeError: 'Map' object has no attribute 'circle_marker'
下面的代码:
#create a map of tweets using Folium import folium, pandas, ast
# get geo data only from rows with non-empty values
locations = pandas.read_csv('./usa_tweets.csv', usecols=[3]).dropna()
geos = []
for location in locations.values:
# add to geos array an evaluated python literal syntax of the data
geos.append(ast.literal_eval(location[0])['coordinates'])
# initialize and create map
tweet_map = folium.Map(location=[52.8, -2], tiles='Mapbox Bright', zoom_start=7)
# add markers
for geo in geos:
tweet_map.circle_marker(location=geo, radius=250)
tweet_map.create
回答:
感谢来自#Python IRC频道的帮助:
for geo in geos: #tweet_map.CircleMarker(location=geo, radius=250)
folium.CircleMarker(location=geo, radius=250).add_to(tweet_map)
tweet_map.save('map.html')
以上是 AttributeError的:“地图”对象有没有属性“circle_marker” 的全部内容, 来源链接: utcz.com/qa/259392.html