Skip to content

Commit 254a793

Browse files
Add pandas-2.3.0 support (#19202)
This PR adds support for `pandas-2.3.0` in `cudf`. Closes: #19099 Authors: - GALI PREM SAGAR (https://github.com/galipremsagar) Approvers: - Vyas Ramasubramani (https://github.com/vyasr) - Matthew Murray (https://github.com/Matt711) URL: #19202
1 parent a87c524 commit 254a793

File tree

15 files changed

+1007
-148
lines changed

15 files changed

+1007
-148
lines changed

conda/environments/all_cuda-128_arch-aarch64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dependencies:
6464
- openpyxl
6565
- packaging
6666
- pandas
67-
- pandas>=2.0,<2.2.4dev0
67+
- pandas>=2.0,<2.4.0dev0
6868
- pandoc
6969
- polars>=1.25,<1.31
7070
- pre-commit

conda/environments/all_cuda-128_arch-x86_64.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ dependencies:
6565
- openpyxl
6666
- packaging
6767
- pandas
68-
- pandas>=2.0,<2.2.4dev0
68+
- pandas>=2.0,<2.4.0dev0
6969
- pandoc
7070
- polars>=1.25,<1.31
7171
- pre-commit

conda/recipes/cudf/recipe.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ requirements:
6767
run:
6868
- python
6969
- typing_extensions >=4.0.0
70-
- pandas >=2.0,<2.2.4dev0
70+
- pandas >=2.0,<2.4.0dev0
7171
- cupy >=12.0.0
7272
- numba-cuda >=0.14.0,<0.15.0a0
7373
- numba >=0.59.1,<0.62.0a0

conda/recipes/pylibcudf/recipe.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ requirements:
6666
run:
6767
- python
6868
- typing_extensions >=4.0.0
69-
- pandas >=2.0,<2.2.4dev0
69+
- pandas >=2.0,<2.4.0dev0
7070
- numpy >=1.23,<3.0a0
7171
- pyarrow>=14.0.0,<20.0.0a0
7272
- libcudf =${{ version }}

dependencies.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ dependencies:
638638
packages:
639639
- fsspec>=0.6.0
640640
- &numpy numpy>=1.23,<3.0a0
641-
- pandas>=2.0,<2.2.4dev0
641+
- pandas>=2.0,<2.4.0dev0
642642
run_pylibcudf:
643643
common:
644644
- output_types: [conda, requirements, pyproject]
@@ -776,7 +776,7 @@ dependencies:
776776
packages:
777777
- *numba-cuda-dep
778778
- *numba-dep
779-
- pandas==2.2.3
779+
- pandas==2.3.0
780780
- matrix:
781781
packages:
782782
- output_types: conda

python/cudf/cudf/core/_compat.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Copyright (c) 2020-2024, NVIDIA CORPORATION.
1+
# Copyright (c) 2020-2025, NVIDIA CORPORATION.
22

33
import pandas as pd
44
from packaging import version
55

6-
PANDAS_CURRENT_SUPPORTED_VERSION = version.parse("2.2.3")
6+
PANDAS_CURRENT_SUPPORTED_VERSION = version.parse("2.3.0")
77
PANDAS_VERSION = version.parse(pd.__version__)
88

99

1010
PANDAS_GE_210 = PANDAS_VERSION >= version.parse("2.1.0")
1111
PANDAS_GT_214 = PANDAS_VERSION > version.parse("2.1.4")
1212
PANDAS_GE_220 = PANDAS_VERSION >= version.parse("2.2.0")
13+
PANDAS_GE_230 = PANDAS_VERSION >= version.parse("2.3.0")
1314
PANDAS_LT_300 = PANDAS_VERSION < version.parse("3.0.0")

python/cudf/cudf/core/accessors/string.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import pylibcudf as plc
1414

1515
import cudf
16+
from cudf.api.extensions import no_default
1617
from cudf.api.types import is_integer, is_scalar
1718
from cudf.core.accessors.base_accessor import BaseAccessor
1819
from cudf.core.column.column import ColumnBase, as_column
@@ -622,7 +623,7 @@ def contains(
622623
pat: str | Sequence,
623624
case: bool = True,
624625
flags: int = 0,
625-
na=np.nan,
626+
na=no_default,
626627
regex: bool = True,
627628
) -> Series | Index:
628629
r"""
@@ -734,7 +735,18 @@ def contains(
734735
The `flags` parameter currently only supports re.DOTALL and
735736
re.MULTILINE.
736737
"""
737-
if na is not np.nan:
738+
if (
739+
na is not no_default
740+
and not pd.isna(na)
741+
and not isinstance(na, bool)
742+
):
743+
# GH#59561
744+
warnings.warn(
745+
"Allowing a non-bool 'na' in obj.str.contains is deprecated "
746+
"and will raise in a future version.",
747+
FutureWarning,
748+
)
749+
if na not in {no_default, np.nan}:
738750
raise NotImplementedError("`na` parameter is not yet supported")
739751
if regex and isinstance(pat, re.Pattern):
740752
flags = pat.flags & ~re.U

python/cudf/cudf/pandas/_wrappers/pandas.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,40 @@ def Index__setattr__(self, name, value):
659659
pd.core.arrays.string_arrow.ArrowStringArrayNumpySemantics,
660660
fast_to_slow=_Unusable(),
661661
slow_to_fast=_Unusable(),
662+
additional_attributes={
663+
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
664+
},
662665
)
663666

667+
if cudf.core._compat.PANDAS_GE_230:
668+
StringArrayNumpySemantics = make_final_proxy_type(
669+
"StringArrayNumpySemantics",
670+
_Unusable,
671+
pd.core.arrays.string_.StringArrayNumpySemantics,
672+
bases=(StringArray,),
673+
fast_to_slow=_Unusable(),
674+
slow_to_fast=_Unusable(),
675+
)
676+
677+
664678
ArrowStringArray = make_final_proxy_type(
665679
"ArrowStringArray",
666680
_Unusable,
667681
pd.core.arrays.string_arrow.ArrowStringArray,
668682
fast_to_slow=_Unusable(),
669683
slow_to_fast=_Unusable(),
684+
additional_attributes={
685+
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
686+
},
687+
)
688+
689+
690+
StorageExtensionDtype = make_final_proxy_type(
691+
"StorageExtensionDtype",
692+
_Unusable,
693+
pd.core.dtypes.base.StorageExtensionDtype,
694+
fast_to_slow=_Unusable(),
695+
slow_to_fast=_Unusable(),
670696
)
671697

672698
StringDtype = make_final_proxy_type(
@@ -1851,6 +1877,9 @@ def holiday_calendar_factory_wrapper(*args, **kwargs):
18511877
pd.arrays.ArrowExtensionArray,
18521878
fast_to_slow=_Unusable(),
18531879
slow_to_fast=_Unusable(),
1880+
additional_attributes={
1881+
"_pa_array": _FastSlowAttribute("_pa_array", private=True),
1882+
},
18541883
)
18551884

18561885

0 commit comments

Comments
 (0)