@@ -1281,7 +1281,6 @@ def test_groupby_two_group_keys_all_nan():
1281
1281
assert result == {}
1282
1282
1283
1283
1284
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
1285
1284
def test_groupby_2d_malformed ():
1286
1285
d = DataFrame (index = range (2 ))
1287
1286
d ["group" ] = ["g1" , "g2" ]
@@ -1290,7 +1289,7 @@ def test_groupby_2d_malformed():
1290
1289
d ["label" ] = ["l1" , "l2" ]
1291
1290
tmp = d .groupby (["group" ]).mean (numeric_only = True )
1292
1291
res_values = np .array ([[0.0 , 1.0 ], [0.0 , 1.0 ]])
1293
- tm .assert_index_equal (tmp .columns , Index (["zeros" , "ones" ]))
1292
+ tm .assert_index_equal (tmp .columns , Index (["zeros" , "ones" ], dtype = object ))
1294
1293
tm .assert_numpy_array_equal (tmp .values , res_values )
1295
1294
1296
1295
@@ -2345,7 +2344,6 @@ def test_groupby_all_nan_groups_drop():
2345
2344
tm .assert_series_equal (result , expected )
2346
2345
2347
2346
2348
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
2349
2347
@pytest .mark .parametrize ("numeric_only" , [True , False ])
2350
2348
def test_groupby_empty_multi_column (as_index , numeric_only ):
2351
2349
# GH 15106 & GH 41998
@@ -2354,15 +2352,14 @@ def test_groupby_empty_multi_column(as_index, numeric_only):
2354
2352
result = gb .sum (numeric_only = numeric_only )
2355
2353
if as_index :
2356
2354
index = MultiIndex ([[], []], [[], []], names = ["A" , "B" ])
2357
- columns = ["C" ] if not numeric_only else []
2355
+ columns = ["C" ] if not numeric_only else Index ([], dtype = "str" )
2358
2356
else :
2359
2357
index = RangeIndex (0 )
2360
2358
columns = ["A" , "B" , "C" ] if not numeric_only else ["A" , "B" ]
2361
2359
expected = DataFrame ([], columns = columns , index = index )
2362
2360
tm .assert_frame_equal (result , expected )
2363
2361
2364
2362
2365
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
2366
2363
def test_groupby_aggregation_non_numeric_dtype ():
2367
2364
# GH #43108
2368
2365
df = DataFrame (
@@ -2373,7 +2370,7 @@ def test_groupby_aggregation_non_numeric_dtype():
2373
2370
{
2374
2371
"v" : [[1 , 1 ], [10 , 20 ]],
2375
2372
},
2376
- index = Index (["M" , "W" ], dtype = "object" , name = "MW" ),
2373
+ index = Index (["M" , "W" ], name = "MW" ),
2377
2374
)
2378
2375
2379
2376
gb = df .groupby (by = ["MW" ])
0 commit comments