Basically after I have already installed folium with pip (pip install folium
)
previously the code worked, but suddenly I got this error.
Here is my code:
JavaScript
x
33
33
1
import pandas as pd
2
import folium
3
from geopy.geocoders import ArcGIS
4
5
#data frame
6
snifim_df = pd.read_csv('Snif.csv')
7
nom = ArcGIS()
8
9
snifim_df['LAT'] = snifim_df['Address'].apply(nom.geocode,timeout=15).apply(lambda x:x.latitude)
10
snifim_df['LON'] = snifim_df['Address'].apply(nom.geocode,timeout=15).apply(lambda x:x.longitude)
11
12
13
Mcmap = folium.Map(location=[32.58, -99.09], zoom_start = 6)
14
fg = folium.FeatureGroup(name = "McDonalds")
15
16
snif_lat = list(snifim_df['LAT'])
17
snif_lon = list(snifim_df['LON'])
18
snif_name = list(snifim_df['Name'])
19
snif_address = List(snifim_df['Address'])
20
21
html = """ <h4>Mcdonalds</h4>
22
Snif_Adress: %s
23
24
"""
25
26
for lat,lon,name,add in zip(snif_lat,snif_lon,snif_name,snif_address):
27
iframe = folium.Iframe(html = html % str(add),width=200, height=100)
28
fg.add_child(folium.Marker(location=[lat,lon],popup=folium.Popup(iframe),icon="glyphicon glyphicon-piggy-bank"))
29
30
31
Mcmap.add_child(fg)
32
Mcmap.save("test.html")
33
Advertisement
Answer
2 possibilities come to my mind:
the first one, cited by Paul, is that you installed it with pip (for Python 2) and you try using it with Python 3 (so you need to install it with pip3 as cited in Paul’s answer)
You have a script file named folium(.py) and you should rename it