20
20
import cudf
21
21
from cudf import DataFrame , Series
22
22
from cudf .api .extensions import no_default
23
- from cudf .core ._compat import PANDAS_GE_200 , PANDAS_GE_210
23
+ from cudf .core ._compat import PANDAS_GE_200 , PANDAS_GE_210 , PANDAS_GE_220
24
24
from cudf .core .udf ._ops import arith_ops , comparison_ops , unary_ops
25
25
from cudf .core .udf .groupby_typing import SUPPORTED_GROUPBY_NUMPY_TYPES
26
26
from cudf .core .udf .utils import UDFError , precompiled
@@ -2745,10 +2745,10 @@ def test_groupby_fillna_multi_value(nelem):
2745
2745
}
2746
2746
# cudf can't fillna with a pandas.Timedelta type
2747
2747
fill_values ["4" ] = fill_values ["4" ].to_numpy ()
2748
-
2749
- expect = pdf .groupby (key_col ).fillna (value = fill_values )
2750
-
2751
- got = gdf .groupby (key_col ).fillna (value = fill_values )
2748
+ with expect_warning_if ( PANDAS_GE_220 ):
2749
+ expect = pdf .groupby (key_col ).fillna (value = fill_values )
2750
+ with pytest . warns ( FutureWarning ):
2751
+ got = gdf .groupby (key_col ).fillna (value = fill_values )
2752
2752
2753
2753
assert_groupby_results_equal (expect [value_cols ], got [value_cols ])
2754
2754
@@ -2791,11 +2791,12 @@ def test_groupby_fillna_multi_value_df(nelem):
2791
2791
# cudf can't fillna with a pandas.Timedelta type
2792
2792
fill_values ["4" ] = fill_values ["4" ].to_numpy ()
2793
2793
fill_values = pd .DataFrame (fill_values , index = pdf .index )
2794
-
2795
- expect = pdf .groupby (key_col ).fillna (value = fill_values )
2794
+ with expect_warning_if ( PANDAS_GE_220 ):
2795
+ expect = pdf .groupby (key_col ).fillna (value = fill_values )
2796
2796
2797
2797
fill_values = cudf .from_pandas (fill_values )
2798
- got = gdf .groupby (key_col ).fillna (value = fill_values )
2798
+ with pytest .warns (FutureWarning ):
2799
+ got = gdf .groupby (key_col ).fillna (value = fill_values )
2799
2800
2800
2801
assert_groupby_results_equal (expect [value_cols ], got [value_cols ])
2801
2802
@@ -2812,11 +2813,13 @@ def test_groupby_various_by_fillna(by, data, args):
2812
2813
ps = pd .Series (data )
2813
2814
gs = cudf .from_pandas (ps )
2814
2815
2815
- with expect_warning_if (PANDAS_GE_210 and "method" in args ):
2816
+ with expect_warning_if (
2817
+ (PANDAS_GE_210 and "method" in args ) or PANDAS_GE_220
2818
+ ):
2816
2819
expect = ps .groupby (by ).fillna (** args )
2817
2820
if isinstance (by , pd .Grouper ):
2818
2821
by = cudf .Grouper (level = by .level )
2819
- with expect_warning_if ( "method" in args ):
2822
+ with pytest . warns ( FutureWarning ):
2820
2823
got = gs .groupby (by ).fillna (** args )
2821
2824
2822
2825
assert_groupby_results_equal (expect , got , check_dtype = False )
0 commit comments