【问题标题】:How to deal with GeoDataFrame object having no attribute explore?如何处理没有属性探索的 GeoDataFrame 对象?
【发布时间】: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 的情况下访问它?

标签: python gis geopandas


【解决方案1】:

gdf.explore() 在 0.10 版(2021 年 10 月 3 日)中添加到 geopandas。请参阅changelog。因此,为了能够使用 explore,您需要更新,例如:

pip install --upgrade geopandas

或者

conda install -c conda-forge geopandas>=0.10.0

【讨论】:

    【解决方案2】:
    pip install --upgrade geopandas
    

    【讨论】:

      猜你喜欢
      • 2021-12-01
      • 2020-03-09
      • 1970-01-01
      • 2020-02-05
      • 1970-01-01
      • 2015-05-08
      • 1970-01-01
      • 2015-10-25
      • 2021-09-11
      相关资源
      最近更新 更多