Home > Back-end >  How to deal with GeoDataFrame object having no attribute explore?
How to deal with GeoDataFrame object having no attribute explore?

Time:06-02

I have already reinstalled geopandas, but I still get error:

---------------------------------------------------------------------------
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'

The code that I am using is:

df = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
df.explore("pop_est", cmap="Blues")  

Thanks!

CodePudding user response:

gdf.explore() was added to geopandas in version 0.10 (Oct 3, 2021). See the changelog. So to be able to use explore, you'll need to update, e.g.:

pip install --upgrade geopandas

or

conda install -c conda-forge geopandas>=0.10.0
  • Related