导入错误:无法从“folium.utilities”导入名称“_validate_location”

问题描述 投票:0回答:1

我尝试了这段代码:

from folium.plugins import MarkerCluster

# let's start again with a clean copy of the map of San Francisco
sanfran_map = folium.Map(location = [latitude, longitude], zoom_start = 12)

# instantiate a mark cluster object for the incidents in the dataframe
incidents = plugins.MarkerCluster().add_to(sanfran_map)

# loop through the dataframe and add each data point to the mark cluster
for lat, lng, label, in zip(df_incidents.Y, df_incidents.X, df_incidents.Category):
    folium.Marker(
        location=[lat, lng],
        icon=None,
        popup=label,
    ).add_to(incidents)

# display map
sanfran_map

此外,我尝试了像这样的第一个

import
部分,但它总是抛出错误。 我希望你能帮助我
    

python python-3.x importerror folium
1个回答
0
投票

from folium import plugins

然后-

pip install folium -U

然后使用“MarkerCluster”对象将标记添加到您的 Folium 地图。
请参阅 - 
Folium 文档和代码示例

© www.soinside.com 2019 - 2024. All rights reserved.