AttributeError: 'Map' object has no attribute 'simple_marker' in folium

AttributeError: 'Map' object has no attribute 'simple_marker' in folium

代码如下

import folium
import pandas as pd
 
SF_COORDINATES = (37.76, -122.45)
crimedata = pd.read_csv('SFPD_Incidents_2015.csv')
 
# for speed purposes
MAX_RECORDS = 1000
  
# create empty map zoomed in on San Francisco
map = folium.Map(location=SF_COORDINATES, zoom_start=12)
 
# add a marker for every record in the filtered data, use a clustered view
for each in crimedata[0:MAX_RECORDS].iterrows():
    map.simple_marker(
        location = [each[1]['Y'],each[1]['X']], 
        clustered_marker = True)
  
display(map)

出现错误:

AttributeError: 'Map' object has no attribute 'simple_marker' in folium

您可以直接查看 heresimple_marker 已被删除。

使用:

  1. folium.Marker() 在地图上创建一个简单的库存传单标记,并且
  2. folium.plugins.MarkerCluster() 用于标记聚类。