Description
In GeoPandas we added a plot
accessor similar to the pandas one (so you can still access all the pandas plotting kinds, also from a GeoDataFrame where the default plot is a spatial map), see geopandas/geopandas#1465.
But, in that PR, we made use of pandas.core.accessor.CachedAccessor
, which is how we add accessors in pandas under the hood:
Lines 9730 to 9731 in ffa6e20
So in GeoPandas we basically copied the above code, but with our adapted GeoPlotAccessor.
The reason that we can't use the public way to add accessors with pd.api.extensions.register_dataframe_accessor
is that we are overriding an existing accessor of pandas (intentionally).
So can we consider CachedAccessor
to be "public"-like so it is fine for GeoPandas to use it? Or do we want to explicitly expose the class in the pandas.api.extensions
namespace? Or can we change register_dataframe_accessor
to allow it to override existing methods? (not sure we want to make that too easy)