'Plotting location data from CSV using folium and jupyter not working
I am trying to plot location data from a csv file onto a folium base map in jupyter notebook. This is my code, and the error I keep getting. I was able to plot location data using lat and long manually inputed, but no luck pulling it from a csv. Any help or insight into what I am doing wrong would be useful. I am very new to python and coding in general. Thank you.
!pip install folium pandas
import folium
folium.Map(location=[32.65651, -86.92715], zoom_start=7)
import csv
m = folium.Map(location=[32.65651, -86.92715], zoom_start=7)
lat=[]
lon=[]
with open ('Some_Collection_Sites_1.csv') as csvfile:
lines = csv.reader(csvfile, delimiter=',')
next(lines)
for row in lines:
lat.append(row[0])
lon.append(row[1])
marker = folium.Marker(
location=(lat, lon),
popup=folium.Popup(max_width=450).add_child(
folium.Vega(df, width=450, height=250)
),
)
marker.add_to(m)
m
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
