【发布时间】:2022-10-15 18:12:07
【问题描述】:
我已经重新安装了 geopandas,但仍然出现错误:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Input In [35], in <cell line: 1>()
----> 1 df.explore("pop_est", cmap="Blues")
File ~\Anaconda3\envs\GPD\lib\site-packages\pandas\core\generic.py:5575, in NDFrame.__getattr__(self, name)
5568 if (
5569 name not in self._internal_names_set
5570 and name not in self._metadata
5571 and name not in self._accessors
5572 and self._info_axis._can_hold_identifiers_and_holds_name(name)
5573 ):
5574 return self[name]
-> 5575 return object.__getattribute__(self, name)
AttributeError: 'GeoDataFrame' object has no attribute 'explore'
我正在使用的代码是:
df = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
df.explore("pop_est", cmap="Blues")
谢谢!
【问题讨论】:
-
你安装了什么版本的 geopandas?你是怎么安装的?
-
我使用的是 0.9.0 版本。
-
gdf.explore()在 0.10 版(2021 年 10 月 3 日)中添加到 geopandas。请参阅changelog。因此,您需要更新以获取新功能。 -
有用!谢谢你。请留下答案,以便我接受。谢谢。
-
还有一个问题。有没有办法将从 gdf.explore() 派生的地图保存为 html,以便可以在没有 python 的情况下访问它?