diff --git a/holoviews/core/data/__init__.py b/holoviews/core/data/__init__.py index 73dcac77d9..cd73b7048c 100644 --- a/holoviews/core/data/__init__.py +++ b/holoviews/core/data/__init__.py @@ -27,7 +27,7 @@ from .interface import Interface, iloc, ndloc from .multipath import MultiInterface # noqa (API import) from .image import ImageInterface # noqa (API import) -from .pandas import PandasInterface +from .pandas import PandasAPI, PandasInterface # noqa (API import) from .spatialpandas import SpatialPandasInterface # noqa (API import) from .spatialpandas_dask import DaskSpatialPandasInterface # noqa (API import) from .xarray import XArrayInterface # noqa (API import) @@ -124,7 +124,7 @@ def __call__(self, new_type, kdims=None, vdims=None, groupby=None, else: selected = self._element else: - if issubclass(self._element.interface, PandasInterface): + if issubclass(self._element.interface, PandasAPI): ds_dims = self._element.dimensions() ds_kdims = [self._element.get_dimension(d) if d in ds_dims else d for d in groupby+kdims] diff --git a/holoviews/core/data/pandas.py b/holoviews/core/data/pandas.py index 383593d21f..8e54d609d4 100644 --- a/holoviews/core/data/pandas.py +++ b/holoviews/core/data/pandas.py @@ -14,7 +14,20 @@ from .util import finite_range -class PandasInterface(Interface): +class PandasAPI: + """ + This class is used to describe the interface as having a pandas-like API. + + The reason to have this class is that it is not always + possible to directly inherit from the PandasInterface. + + This class should not have any logic as it should be used like: + if issubclass(interface, PandasAPI): + ... + """ + + +class PandasInterface(Interface, PandasAPI): types = (pd.DataFrame,)