diff --git a/apis/python/src/tiledbsoma/io/conversions.py b/apis/python/src/tiledbsoma/io/conversions.py index 982da7b739..f4f972fc1f 100644 --- a/apis/python/src/tiledbsoma/io/conversions.py +++ b/apis/python/src/tiledbsoma/io/conversions.py @@ -12,7 +12,6 @@ import pandas as pd import pandas._typing as pdt import scipy.sparse as sp -from pandas.api.types import is_categorical_dtype from .._funcs import typeguard_ignore from .._types import NPNDArray, PDSeries @@ -46,7 +45,9 @@ def to_tiledb_supported_array_type(name: str, x: _MT) -> _MT: """Converts datatypes unrepresentable by TileDB into datatypes it can represent. E.g., float16 -> float32 """ - if isinstance(x, (np.ndarray, sp.spmatrix)) or not is_categorical_dtype(x): + if isinstance(x, (np.ndarray, sp.spmatrix)) or not isinstance( + x, pd.CategoricalDtype + ): # mypy issues a spurious error here, but only when # _to_tiledb_supported_dtype is decorated with @typeguard_ignore??? target_dtype = _to_tiledb_supported_dtype(x.dtype) # type: ignore[arg-type]