Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a pandas-2.0 missing attribute error #16416

Merged
merged 1 commit into from
Jul 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions python/cudf/cudf/core/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@
from pandas.core.arrays.arrow.extension_types import ArrowIntervalType

import cudf
from cudf.core._compat import PANDAS_LT_300
from cudf.core._compat import PANDAS_GE_210, PANDAS_LT_300
from cudf.core.abc import Serializable
from cudf.utils.docutils import doc_apply

if PANDAS_GE_210:
PANDAS_NUMPY_DTYPE = pd.core.dtypes.dtypes.NumpyEADtype
else:
PANDAS_NUMPY_DTYPE = pd.core.dtypes.dtypes.PandasDtype

if TYPE_CHECKING:
from cudf._typing import Dtype
from cudf.core.buffer import Buffer
Expand Down Expand Up @@ -72,7 +77,7 @@ def dtype(arbitrary):
return np.dtype("object")
else:
return dtype(pd_dtype.numpy_dtype)
elif isinstance(pd_dtype, pd.core.dtypes.dtypes.NumpyEADtype):
elif isinstance(pd_dtype, PANDAS_NUMPY_DTYPE):
return dtype(pd_dtype.numpy_dtype)
elif isinstance(pd_dtype, pd.CategoricalDtype):
return cudf.CategoricalDtype.from_pandas(pd_dtype)
Expand Down
Loading