@@ -25,9 +25,12 @@ def test_multiindex_group_all_columns_when_empty(groupby_func):
25
25
gb = df .groupby (["a" , "b" , "c" ], group_keys = False )
26
26
method = getattr (gb , groupby_func )
27
27
args = get_groupby_method_args (groupby_func , df )
28
-
29
- warn = FutureWarning if groupby_func == "fillna" else None
30
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
28
+ if groupby_func == "corrwith" :
29
+ warn = FutureWarning
30
+ warn_msg = "DataFrameGroupBy.corrwith is deprecated"
31
+ else :
32
+ warn = None
33
+ warn_msg = ""
31
34
with tm .assert_produces_warning (warn , match = warn_msg ):
32
35
result = method (* args ).index
33
36
expected = df .index
@@ -42,18 +45,12 @@ def test_duplicate_columns(request, groupby_func, as_index):
42
45
df = DataFrame ([[1 , 3 , 6 ], [1 , 4 , 7 ], [2 , 5 , 8 ]], columns = list ("abb" ))
43
46
args = get_groupby_method_args (groupby_func , df )
44
47
gb = df .groupby ("a" , as_index = as_index )
45
- warn = FutureWarning if groupby_func == "fillna" else None
46
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
47
- with tm .assert_produces_warning (warn , match = warn_msg ):
48
- result = getattr (gb , groupby_func )(* args )
48
+ result = getattr (gb , groupby_func )(* args )
49
49
50
50
expected_df = df .set_axis (["a" , "b" , "c" ], axis = 1 )
51
51
expected_args = get_groupby_method_args (groupby_func , expected_df )
52
52
expected_gb = expected_df .groupby ("a" , as_index = as_index )
53
- warn = FutureWarning if groupby_func == "fillna" else None
54
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
55
- with tm .assert_produces_warning (warn , match = warn_msg ):
56
- expected = getattr (expected_gb , groupby_func )(* expected_args )
53
+ expected = getattr (expected_gb , groupby_func )(* expected_args )
57
54
if groupby_func not in ("size" , "ngroup" , "cumcount" ):
58
55
expected = expected .rename (columns = {"c" : "b" })
59
56
tm .assert_equal (result , expected )
@@ -74,8 +71,12 @@ def test_dup_labels_output_shape(groupby_func, idx):
74
71
grp_by = df .groupby ([0 ])
75
72
76
73
args = get_groupby_method_args (groupby_func , df )
77
- warn = FutureWarning if groupby_func == "fillna" else None
78
- warn_msg = "DataFrameGroupBy.fillna is deprecated"
74
+ if groupby_func == "corrwith" :
75
+ warn = FutureWarning
76
+ warn_msg = "DataFrameGroupBy.corrwith is deprecated"
77
+ else :
78
+ warn = None
79
+ warn_msg = ""
79
80
with tm .assert_produces_warning (warn , match = warn_msg ):
80
81
result = getattr (grp_by , groupby_func )(* args )
81
82
0 commit comments