Skip to content

Add pandas-2.3.0 support #19202

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

Merged
merged 12 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-128_arch-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies:
- openpyxl
- packaging
- pandas
- pandas>=2.0,<2.2.4dev0
- pandas>=2.0,<2.4.0dev0
- pandoc
- polars>=1.25,<1.31
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion conda/environments/all_cuda-128_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ dependencies:
- openpyxl
- packaging
- pandas
- pandas>=2.0,<2.2.4dev0
- pandas>=2.0,<2.4.0dev0
- pandoc
- polars>=1.25,<1.31
- pre-commit
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/cudf/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ requirements:
run:
- python
- typing_extensions >=4.0.0
- pandas >=2.0,<2.2.4dev0
- pandas >=2.0,<2.4.0dev0
- cupy >=12.0.0
- numba-cuda >=0.14.0,<0.15.0a0
- numba >=0.59.1,<0.62.0a0
Expand Down
2 changes: 1 addition & 1 deletion conda/recipes/pylibcudf/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ requirements:
run:
- python
- typing_extensions >=4.0.0
- pandas >=2.0,<2.2.4dev0
- pandas >=2.0,<2.4.0dev0
- numpy >=1.23,<3.0a0
- pyarrow>=14.0.0,<20.0.0a0
- libcudf =${{ version }}
Expand Down
4 changes: 2 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ dependencies:
packages:
- fsspec>=0.6.0
- &numpy numpy>=1.23,<3.0a0
- pandas>=2.0,<2.2.4dev0
- pandas>=2.0,<2.4.0dev0
run_pylibcudf:
common:
- output_types: [conda, requirements, pyproject]
Expand Down Expand Up @@ -776,7 +776,7 @@ dependencies:
packages:
- *numba-cuda-dep
- *numba-dep
- pandas==2.2.3
- pandas==2.3.0
- matrix:
packages:
- output_types: conda
Expand Down
5 changes: 3 additions & 2 deletions python/cudf/cudf/core/_compat.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
# Copyright (c) 2020-2025, NVIDIA CORPORATION.

import pandas as pd
from packaging import version

PANDAS_CURRENT_SUPPORTED_VERSION = version.parse("2.2.3")
PANDAS_CURRENT_SUPPORTED_VERSION = version.parse("2.3.0")
PANDAS_VERSION = version.parse(pd.__version__)


PANDAS_GE_210 = PANDAS_VERSION >= version.parse("2.1.0")
PANDAS_GT_214 = PANDAS_VERSION > version.parse("2.1.4")
PANDAS_GE_220 = PANDAS_VERSION >= version.parse("2.2.0")
PANDAS_GE_230 = PANDAS_VERSION >= version.parse("2.3.0")
PANDAS_LT_300 = PANDAS_VERSION < version.parse("3.0.0")
16 changes: 14 additions & 2 deletions python/cudf/cudf/core/accessors/string.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import pylibcudf as plc

import cudf
from cudf.api.extensions import no_default
from cudf.api.types import is_integer, is_scalar
from cudf.core.accessors.base_accessor import BaseAccessor
from cudf.core.column.column import ColumnBase, as_column
Expand Down Expand Up @@ -622,7 +623,7 @@ def contains(
pat: str | Sequence,
case: bool = True,
flags: int = 0,
na=np.nan,
na=no_default,
regex: bool = True,
) -> Series | Index:
r"""
Expand Down Expand Up @@ -734,7 +735,18 @@ def contains(
The `flags` parameter currently only supports re.DOTALL and
re.MULTILINE.
"""
if na is not np.nan:
if (
na is not no_default
and not pd.isna(na)
and not isinstance(na, bool)
):
# GH#59561
warnings.warn(
"Allowing a non-bool 'na' in obj.str.contains is deprecated "
"and will raise in a future version.",
FutureWarning,
)
if na not in {no_default, np.nan}:
raise NotImplementedError("`na` parameter is not yet supported")
if regex and isinstance(pat, re.Pattern):
flags = pat.flags & ~re.U
Expand Down
29 changes: 29 additions & 0 deletions python/cudf/cudf/pandas/_wrappers/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,40 @@ def Index__setattr__(self, name, value):
pd.core.arrays.string_arrow.ArrowStringArrayNumpySemantics,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
additional_attributes={
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
},
)

if cudf.core._compat.PANDAS_GE_230:
StringArrayNumpySemantics = make_final_proxy_type(
"StringArrayNumpySemantics",
_Unusable,
pd.core.arrays.string_.StringArrayNumpySemantics,
bases=(StringArray,),
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
)


ArrowStringArray = make_final_proxy_type(
"ArrowStringArray",
_Unusable,
pd.core.arrays.string_arrow.ArrowStringArray,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
additional_attributes={
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
},
)


StorageExtensionDtype = make_final_proxy_type(
"StorageExtensionDtype",
_Unusable,
pd.core.dtypes.base.StorageExtensionDtype,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
)

StringDtype = make_final_proxy_type(
Expand Down Expand Up @@ -1851,6 +1877,9 @@ def holiday_calendar_factory_wrapper(*args, **kwargs):
pd.arrays.ArrowExtensionArray,
fast_to_slow=_Unusable(),
slow_to_fast=_Unusable(),
additional_attributes={
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
},
)


Expand Down
Loading