基本上在我之前已经安装了带有pip(pip install folium
)的folium之后,代码工作正常,但是突然我得到了这个错误。
下面是我的代码:
import pandas as pd
import folium
from geopy.geocoders import ArcGIS
#data frame
snifim_df = pd.read_csv('Snif.csv')
nom = ArcGIS()
snifim_df['LAT'] = snifim_df['Address'].apply(nom.geocode,timeout=15).apply(lambda x:x.latitude)
snifim_df['LON'] = snifim_df['Address'].apply(nom.geocode,timeout=15).apply(lambda x:x.longitude)
Mcmap = folium.Map(location=[32.58, -99.09], zoom_start = 6)
fg = folium.FeatureGroup(name = "McDonalds")
snif_lat = list(snifim_df['LAT'])
snif_lon = list(snifim_df['LON'])
snif_name = list(snifim_df['Name'])
snif_address = List(snifim_df['Address'])
html = """ <h4>Mcdonalds</h4>
Snif_Adress: %s
"""
for lat,lon,name,add in zip(snif_lat,snif_lon,snif_name,snif_address):
iframe = folium.Iframe(html = html % str(add),width=200, height=100)
fg.add_child(folium.Marker(location=[lat,lon],popup=folium.Popup(iframe),icon="glyphicon glyphicon-piggy-bank"))
Mcmap.add_child(fg)
Mcmap.save("test.html")
3条答案
按热度按时间icnyk63a1#
我想到两种可能性:
c3frrgcw2#
在黑暗中拍摄...
尝试:
可能是为python 2.7安装了它,而不是为python 3.x安装的
jv4diomz3#
python3 -m pip install <package_name>
这样可以确保你安装的包是你所使用的python版本。