Skip to content

Commit 6d453df

Browse files
authored
Add the fast type to the NamedAgg wrapper in cudf.pandas (#21135)
Authors: - Matthew Murray (https://github.com/Matt711) Approvers: - Matthew Roeschke (https://github.com/mroeschke) URL: #21135
1 parent 4a8cdb2 commit 6d453df

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import abc
44
import copyreg
@@ -2068,10 +2068,10 @@ def holiday_calendar_factory_wrapper(*args, **kwargs):
20682068

20692069
NamedAgg = make_final_proxy_type(
20702070
"NamedAgg",
2071-
_Unusable,
20722071
pd.NamedAgg,
2073-
fast_to_slow=_Unusable(),
2074-
slow_to_fast=_Unusable(),
2072+
pd.NamedAgg,
2073+
fast_to_slow=lambda fast: fast,
2074+
slow_to_fast=lambda slow: slow,
20752075
additional_attributes={
20762076
"__hash__": _FastSlowAttribute("__hash__"),
20772077
},

python/cudf/cudf_pandas_tests/test_cudf_pandas_no_fallback.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
import pytest
@@ -151,3 +151,11 @@ def test_no_fallback_in_memory_usage_and_sizeof(dataframe, series):
151151
with pytest.warns(UserWarning, match="The deep parameter is ignored"):
152152
i.memory_usage(deep=True)
153153
i.__sizeof__()
154+
155+
156+
def test_no_fallback_in_named_agg(dataframe):
157+
df = dataframe
158+
df.groupby("a").agg(
159+
min_b=pd.NamedAgg(column="b", aggfunc="min"),
160+
max_c=pd.NamedAgg(column="c", aggfunc="max"),
161+
)

0 commit comments

Comments
 (0)