@@ -163,7 +163,7 @@ def max_value(group):
163
163
return group .loc [group ["value" ].idxmax ()]
164
164
165
165
msg = "DataFrameGroupBy.apply operated on the grouping columns"
166
- with tm .assert_produces_warning (FutureWarning , match = msg ):
166
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
167
167
applied = df .groupby ("A" ).apply (max_value )
168
168
result = applied .dtypes
169
169
expected = df .dtypes
@@ -186,7 +186,7 @@ def f_0(grp):
186
186
187
187
expected = df .groupby ("A" ).first ()[["B" ]]
188
188
msg = "DataFrameGroupBy.apply operated on the grouping columns"
189
- with tm .assert_produces_warning (FutureWarning , match = msg ):
189
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
190
190
result = df .groupby ("A" ).apply (f_0 )[["B" ]]
191
191
tm .assert_frame_equal (result , expected )
192
192
@@ -196,7 +196,7 @@ def f_1(grp):
196
196
return grp .iloc [0 ]
197
197
198
198
msg = "DataFrameGroupBy.apply operated on the grouping columns"
199
- with tm .assert_produces_warning (FutureWarning , match = msg ):
199
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
200
200
result = df .groupby ("A" ).apply (f_1 )[["B" ]]
201
201
e = expected .copy ()
202
202
e .loc ["Tiger" ] = np .nan
@@ -208,7 +208,7 @@ def f_2(grp):
208
208
return grp .iloc [0 ]
209
209
210
210
msg = "DataFrameGroupBy.apply operated on the grouping columns"
211
- with tm .assert_produces_warning (FutureWarning , match = msg ):
211
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
212
212
result = df .groupby ("A" ).apply (f_2 )[["B" ]]
213
213
e = expected .copy ()
214
214
e .loc ["Pony" ] = np .nan
@@ -221,7 +221,7 @@ def f_3(grp):
221
221
return grp .iloc [0 ]
222
222
223
223
msg = "DataFrameGroupBy.apply operated on the grouping columns"
224
- with tm .assert_produces_warning (FutureWarning , match = msg ):
224
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
225
225
result = df .groupby ("A" ).apply (f_3 )[["C" ]]
226
226
e = df .groupby ("A" ).first ()[["C" ]]
227
227
e .loc ["Pony" ] = pd .NaT
@@ -234,7 +234,7 @@ def f_4(grp):
234
234
return grp .iloc [0 ].loc ["C" ]
235
235
236
236
msg = "DataFrameGroupBy.apply operated on the grouping columns"
237
- with tm .assert_produces_warning (FutureWarning , match = msg ):
237
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
238
238
result = df .groupby ("A" ).apply (f_4 )
239
239
e = df .groupby ("A" ).first ()["C" ].copy ()
240
240
e .loc ["Pony" ] = np .nan
@@ -421,9 +421,9 @@ def f3(x):
421
421
422
422
# correct result
423
423
msg = "DataFrameGroupBy.apply operated on the grouping columns"
424
- with tm .assert_produces_warning (FutureWarning , match = msg ):
424
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
425
425
result1 = df .groupby ("a" ).apply (f1 )
426
- with tm .assert_produces_warning (FutureWarning , match = msg ):
426
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
427
427
result2 = df2 .groupby ("a" ).apply (f1 )
428
428
tm .assert_frame_equal (result1 , result2 )
429
429
@@ -1377,13 +1377,13 @@ def summarize_random_name(df):
1377
1377
return Series ({"count" : 1 , "mean" : 2 , "omissions" : 3 }, name = df .iloc [0 ]["A" ])
1378
1378
1379
1379
msg = "DataFrameGroupBy.apply operated on the grouping columns"
1380
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1380
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1381
1381
metrics = df .groupby ("A" ).apply (summarize )
1382
1382
assert metrics .columns .name is None
1383
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1383
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1384
1384
metrics = df .groupby ("A" ).apply (summarize , "metrics" )
1385
1385
assert metrics .columns .name == "metrics"
1386
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1386
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1387
1387
metrics = df .groupby ("A" ).apply (summarize_random_name )
1388
1388
assert metrics .columns .name is None
1389
1389
@@ -1678,7 +1678,7 @@ def test_dont_clobber_name_column():
1678
1678
)
1679
1679
1680
1680
msg = "DataFrameGroupBy.apply operated on the grouping columns"
1681
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1681
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1682
1682
result = df .groupby ("key" , group_keys = False ).apply (lambda x : x )
1683
1683
tm .assert_frame_equal (result , df )
1684
1684
@@ -1762,7 +1762,7 @@ def freducex(x):
1762
1762
1763
1763
# make sure all these work
1764
1764
msg = "DataFrameGroupBy.apply operated on the grouping columns"
1765
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1765
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1766
1766
grouped .apply (f )
1767
1767
grouped .aggregate (freduce )
1768
1768
grouped .aggregate ({"C" : freduce , "D" : freduce })
@@ -1785,7 +1785,7 @@ def f(group):
1785
1785
return group .copy ()
1786
1786
1787
1787
msg = "DataFrameGroupBy.apply operated on the grouping columns"
1788
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1788
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1789
1789
df .groupby ("a" , sort = False , group_keys = False ).apply (f )
1790
1790
1791
1791
expected_names = [0 , 1 , 2 ]
@@ -1993,7 +1993,7 @@ def test_sort(x):
1993
1993
tm .assert_frame_equal (x , x .sort_values (by = sort_column ))
1994
1994
1995
1995
msg = "DataFrameGroupBy.apply operated on the grouping columns"
1996
- with tm .assert_produces_warning (FutureWarning , match = msg ):
1996
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
1997
1997
g .apply (test_sort )
1998
1998
1999
1999
@@ -2180,7 +2180,7 @@ def test_empty_groupby_apply_nonunique_columns():
2180
2180
df .columns = [0 , 1 , 2 , 0 ]
2181
2181
gb = df .groupby (df [1 ], group_keys = False )
2182
2182
msg = "DataFrameGroupBy.apply operated on the grouping columns"
2183
- with tm .assert_produces_warning (FutureWarning , match = msg ):
2183
+ with tm .assert_produces_warning (DeprecationWarning , match = msg ):
2184
2184
res = gb .apply (lambda x : x )
2185
2185
assert (res .dtypes == df .dtypes ).all ()
2186
2186
0 commit comments