@@ -1281,7 +1281,6 @@ def test_groupby_two_group_keys_all_nan():
12811281 assert result == {}
12821282
12831283
1284- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
12851284def test_groupby_2d_malformed ():
12861285 d = DataFrame (index = range (2 ))
12871286 d ["group" ] = ["g1" , "g2" ]
@@ -1290,7 +1289,7 @@ def test_groupby_2d_malformed():
12901289 d ["label" ] = ["l1" , "l2" ]
12911290 tmp = d .groupby (["group" ]).mean (numeric_only = True )
12921291 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 ))
12941293 tm .assert_numpy_array_equal (tmp .values , res_values )
12951294
12961295
@@ -2345,7 +2344,6 @@ def test_groupby_all_nan_groups_drop():
23452344 tm .assert_series_equal (result , expected )
23462345
23472346
2348- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
23492347@pytest .mark .parametrize ("numeric_only" , [True , False ])
23502348def test_groupby_empty_multi_column (as_index , numeric_only ):
23512349 # GH 15106 & GH 41998
@@ -2354,15 +2352,14 @@ def test_groupby_empty_multi_column(as_index, numeric_only):
23542352 result = gb .sum (numeric_only = numeric_only )
23552353 if as_index :
23562354 index = MultiIndex ([[], []], [[], []], names = ["A" , "B" ])
2357- columns = ["C" ] if not numeric_only else []
2355+ columns = ["C" ] if not numeric_only else Index ([], dtype = "str" )
23582356 else :
23592357 index = RangeIndex (0 )
23602358 columns = ["A" , "B" , "C" ] if not numeric_only else ["A" , "B" ]
23612359 expected = DataFrame ([], columns = columns , index = index )
23622360 tm .assert_frame_equal (result , expected )
23632361
23642362
2365- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
23662363def test_groupby_aggregation_non_numeric_dtype ():
23672364 # GH #43108
23682365 df = DataFrame (
@@ -2373,7 +2370,7 @@ def test_groupby_aggregation_non_numeric_dtype():
23732370 {
23742371 "v" : [[1 , 1 ], [10 , 20 ]],
23752372 },
2376- index = Index (["M" , "W" ], dtype = "object" , name = "MW" ),
2373+ index = Index (["M" , "W" ], name = "MW" ),
23772374 )
23782375
23792376 gb = df .groupby (by = ["MW" ])
0 commit comments