I am having trouble plotting coordinates from the values found in my data frame onto my folium map. All questions & answers I have searched on StackOverflow show people using the exact same process as me to achieve their results however mine produces an error. Anybody have any ideas why I am receiving this error? Below is my data frame, my code for plotting the points, and the unusual error.
Code
for animal in animals:
url = 'http://www.bloowatch.org{}'.format
icon_image = url(animals['image'])
icon = folium.features.CustomIcon(f"http://www.bloowatch.org{animals['image']}", icon_size=(30,30))
folium.Marker(
location = [animals['lat'], animals['lon']],
icon = icon,
popup=animals['population']
).add_to(m)
Error
ValueError: Location should consist of two numerical values, but 0 21.0
1 34.0
2 -6.0
3 21.0
4 -3.0
5 29.0
6 -3.0
7 -14.0
8 -18.0
9 -22.0
10 27.0
11 77.0
Name: lat, dtype: float64 of type <class 'pandas.core.series.Series'> is not convertible to float.
As you can see, cannot convert float to float is baffling me.
Any ideas as to how to overcome this would be great, thanks.
The Location Parameter only gets a list or tuple with two values,
location (tuple or list, default None) – Latitude and Longitude of Map (Northing, Easting).
you're giving it a list of values. For example, to pass only two values
import folium
m = folium.Map(location=[45.5236, -122.6750])