python - 属性错误: Map object has no attribute 'create_map'

标签 python python-3.x dictionary folium

我需要一些帮助,我尝试在代码中使用 folium 但不断收到此错误消息:

Attribute Error : Map object has no attribute 'create_map'

这是我得到的(列表中没有 create_map):

dir(folium.Map)

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', 
 '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', 
 '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', 
 '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', 
 '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 
 '_get_self_bounds', '_repr_html_', '_repr_png_', '_to_png', 'add_child' , 
 'add_children', 'add_tile_layer', 'add_to', 'choropleth', 'fit_bounds', 
'get_bounds', 'get_name', 'get_root', 'render', 'save', 'to_dict', 'to_json']

代码是:

import folium
map_osm = folium.Map(location=[45.5236, -122.6750])
map_osm.create_map(path='osm.html')

P.S:folium 版本 0.5.0//Python 3.6.4

最佳答案

您可以使用save将 map 保存为 HTML 的方法。

例如

map_osm.save('osm.html')

dir(folium.Map) 的输出中也提到了这一点

enter image description here

关于python - 属性错误: Map object has no attribute 'create_map' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49425270/

相关文章:

python - MongoDB 和 web2py : Working with ObjectIds

python - 将变量内容转换为代码行

python - python 列表中的元素存储在哪里?

JavaScript - 从字典键生成组合并动态保留键名

python - Django +Celery +SQS -> boto.exception.SQSError : SQSError: 599 gnutls_handshake()

python - PyQt5 QLCD数字显示

python - 如何计算 python 列表中的 XML 字符串元素?

android - 当我只选择伦敦位置时,我在谷歌地图上崩溃了

python - 列表元素与字典键之间的比较

Python 格式和 Pandas