Search code examples
python-3.xgeopandasfolium

AttributeError: 'Map' object has no attribute 'Marker'


I have the following code:

import folium
from folium.plugins import MarkerCluster

map1 = folium.Map(location=SF_COORDINATES, zoom_start=12)
marker_cluster = MarkerCluster().add_to(map1) 

for each in data[0:MAX_RECORDS].iterrows():
    map1.Marker(location = [each[1]['Y'],each[1]['X']], 
    clustered_marker = True).add_to(marker_cluster)

display(map1)

And I get this error message:

AttributeError: 'Map' object has no attribute 'Marker'

Can anyone help? Thanks.


Solution

  • Marker is part of folium, not of folium.Map.

    See the folium Getting Started.