How to deal with GeoDataFrame object having no attribute explore?

Question:

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 ~Anaconda3envsGPDlibsite-packagespandascoregeneric.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!

Asked By: Isaac A

||

Answers:

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
Answered By: Michael Delgado
pip install --upgrade geopandas
Answered By: Lee Ping-Nam
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.