@@ -212,7 +212,7 @@ def f(x):
212
212
tm .assert_index_equal ((desc_result .stack ().index .get_level_values (1 )), exp )
213
213
214
214
215
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
215
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
216
216
def test_level_get_group (observed ):
217
217
# GH15155
218
218
df = DataFrame (
@@ -277,7 +277,7 @@ def test_apply(ordered):
277
277
tm .assert_series_equal (result , expected )
278
278
279
279
280
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
280
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
281
281
def test_observed (observed ):
282
282
# multiple groupers, don't re-expand the output space
283
283
# of the grouper
@@ -386,7 +386,7 @@ def test_observed(observed):
386
386
tm .assert_frame_equal (result , expected )
387
387
388
388
389
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
389
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
390
390
def test_observed_codes_remap (observed ):
391
391
d = {"C1" : [3 , 3 , 4 , 5 ], "C2" : [1 , 2 , 3 , 4 ], "C3" : [10 , 100 , 200 , 34 ]}
392
392
df = DataFrame (d )
@@ -427,7 +427,7 @@ def test_observed_perf():
427
427
assert result .index .levels [2 ].nunique () == df .other_id .nunique ()
428
428
429
429
430
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
430
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
431
431
def test_observed_groups (observed ):
432
432
# gh-20583
433
433
# test that we have the appropriate groups
@@ -450,7 +450,7 @@ def test_observed_groups(observed):
450
450
tm .assert_dict_equal (result , expected )
451
451
452
452
453
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
453
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
454
454
def test_observed_groups_with_nan (observed ):
455
455
# GH 24740
456
456
df = DataFrame (
@@ -487,7 +487,7 @@ def test_observed_nth():
487
487
tm .assert_series_equal (result , expected )
488
488
489
489
490
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
490
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
491
491
def test_dataframe_categorical_with_nan (observed ):
492
492
# GH 21151
493
493
s1 = Categorical ([np .nan , "a" , np .nan , "a" ], categories = ["a" , "b" , "c" ])
@@ -511,7 +511,7 @@ def test_dataframe_categorical_with_nan(observed):
511
511
@pytest .mark .parametrize ("ordered" , [True , False ])
512
512
@pytest .mark .parametrize ("observed" , [True , False ])
513
513
@pytest .mark .parametrize ("sort" , [True , False ])
514
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
514
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
515
515
def test_dataframe_categorical_ordered_observed_sort (ordered , observed , sort ):
516
516
# GH 25871: Fix groupby sorting on ordered Categoricals
517
517
# GH 25167: Groupby with observed=True doesn't sort
@@ -1176,7 +1176,7 @@ def test_seriesgroupby_observed_true(df_cat, operation, kwargs):
1176
1176
1177
1177
@pytest .mark .parametrize ("operation" , ["agg" , "apply" ])
1178
1178
@pytest .mark .parametrize ("observed" , [False , None ])
1179
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1179
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1180
1180
def test_seriesgroupby_observed_false_or_none (df_cat , observed , operation ):
1181
1181
# GH 24880
1182
1182
index , _ = MultiIndex .from_product (
@@ -1241,7 +1241,7 @@ def test_seriesgroupby_observed_false_or_none(df_cat, observed, operation):
1241
1241
),
1242
1242
],
1243
1243
)
1244
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1244
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1245
1245
def test_seriesgroupby_observed_apply_dict (df_cat , observed , index , data ):
1246
1246
# GH 24880
1247
1247
expected = Series (data = data , index = index , name = "C" )
@@ -1259,7 +1259,7 @@ def test_groupby_categorical_series_dataframe_consistent(df_cat):
1259
1259
1260
1260
1261
1261
@pytest .mark .parametrize ("code" , [([1 , 0 , 0 ]), ([0 , 0 , 0 ])])
1262
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1262
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1263
1263
def test_groupby_categorical_axis_1 (code ):
1264
1264
# GH 13420
1265
1265
df = DataFrame ({"a" : [1 , 2 , 3 , 4 ], "b" : [- 1 , - 2 , - 3 , - 4 ], "c" : [5 , 6 , 7 , 8 ]})
@@ -1269,7 +1269,7 @@ def test_groupby_categorical_axis_1(code):
1269
1269
tm .assert_frame_equal (result , expected )
1270
1270
1271
1271
1272
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1272
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1273
1273
def test_groupby_cat_preserves_structure (observed , ordered ):
1274
1274
# GH 28787
1275
1275
df = DataFrame (
@@ -1298,7 +1298,7 @@ def test_get_nonexistent_category():
1298
1298
)
1299
1299
1300
1300
1301
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1301
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1302
1302
def test_series_groupby_on_2_categoricals_unobserved (reduction_func , observed , request ):
1303
1303
# GH 17605
1304
1304
if reduction_func == "ngroup" :
@@ -1398,7 +1398,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_true(reduction_fun
1398
1398
1399
1399
1400
1400
@pytest .mark .parametrize ("observed" , [False , None ])
1401
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1401
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1402
1402
def test_dataframe_groupby_on_2_categoricals_when_observed_is_false (
1403
1403
reduction_func , observed , request
1404
1404
):
@@ -1432,7 +1432,7 @@ def test_dataframe_groupby_on_2_categoricals_when_observed_is_false(
1432
1432
assert (res .loc [unobserved_cats ] == expected ).all ().all ()
1433
1433
1434
1434
1435
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1435
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1436
1436
def test_series_groupby_categorical_aggregation_getitem ():
1437
1437
# GH 8870
1438
1438
d = {"foo" : [10 , 8 , 4 , 1 ], "bar" : [10 , 20 , 30 , 40 ], "baz" : ["d" , "c" , "d" , "c" ]}
@@ -1446,8 +1446,7 @@ def test_series_groupby_categorical_aggregation_getitem():
1446
1446
1447
1447
1448
1448
@pytest .mark .parametrize (
1449
- "func, expected_values" ,
1450
- [(Series .nunique , [1 , 1 , 2 ]), (Series .count , [1 , 2 , 2 ])],
1449
+ "func, expected_values" , [(Series .nunique , [1 , 1 , 2 ]), (Series .count , [1 , 2 , 2 ])],
1451
1450
)
1452
1451
def test_groupby_agg_categorical_columns (func , expected_values ):
1453
1452
# 31256
@@ -1488,7 +1487,7 @@ def test_groupy_first_returned_categorical_instead_of_dataframe(func):
1488
1487
tm .assert_series_equal (result , expected )
1489
1488
1490
1489
1491
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1490
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1492
1491
def test_read_only_category_no_sort ():
1493
1492
# GH33410
1494
1493
cats = np .array ([1 , 2 ])
@@ -1502,7 +1501,7 @@ def test_read_only_category_no_sort():
1502
1501
tm .assert_frame_equal (result , expected )
1503
1502
1504
1503
1505
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1504
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1506
1505
def test_sorted_missing_category_values ():
1507
1506
# GH 28597
1508
1507
df = DataFrame (
@@ -1650,7 +1649,7 @@ def test_categorical_transform():
1650
1649
1651
1650
1652
1651
@pytest .mark .parametrize ("func" , ["first" , "last" ])
1653
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1652
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1654
1653
def test_series_groupby_first_on_categorical_col_grouped_on_2_categoricals (
1655
1654
func : str , observed : bool
1656
1655
):
@@ -1676,7 +1675,7 @@ def test_series_groupby_first_on_categorical_col_grouped_on_2_categoricals(
1676
1675
1677
1676
1678
1677
@pytest .mark .parametrize ("func" , ["first" , "last" ])
1679
- @pytest .mark .filterwarnings ("ignore:Using 'observed :FutureWarning" )
1678
+ @pytest .mark .filterwarnings ("ignore:Grouping by a categorical :FutureWarning" )
1680
1679
def test_df_groupby_first_on_categorical_col_grouped_on_2_categoricals (
1681
1680
func : str , observed : bool
1682
1681
):
0 commit comments