@@ -1617,7 +1617,6 @@ def test_groupby_two_group_keys_all_nan():
16171617 assert result == {}
16181618
16191619
1620- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
16211620def test_groupby_2d_malformed ():
16221621 d = DataFrame (index = range (2 ))
16231622 d ["group" ] = ["g1" , "g2" ]
@@ -1626,7 +1625,7 @@ def test_groupby_2d_malformed():
16261625 d ["label" ] = ["l1" , "l2" ]
16271626 tmp = d .groupby (["group" ]).mean (numeric_only = True )
16281627 res_values = np .array ([[0.0 , 1.0 ], [0.0 , 1.0 ]])
1629- tm .assert_index_equal (tmp .columns , Index (["zeros" , "ones" ]))
1628+ tm .assert_index_equal (tmp .columns , Index (["zeros" , "ones" ], dtype = object ))
16301629 tm .assert_numpy_array_equal (tmp .values , res_values )
16311630
16321631
@@ -2711,7 +2710,6 @@ def test_groupby_all_nan_groups_drop():
27112710 tm .assert_series_equal (result , expected )
27122711
27132712
2714- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
27152713@pytest .mark .parametrize ("numeric_only" , [True , False ])
27162714def test_groupby_empty_multi_column (as_index , numeric_only ):
27172715 # GH 15106 & GH 41998
@@ -2720,15 +2718,14 @@ def test_groupby_empty_multi_column(as_index, numeric_only):
27202718 result = gb .sum (numeric_only = numeric_only )
27212719 if as_index :
27222720 index = MultiIndex ([[], []], [[], []], names = ["A" , "B" ])
2723- columns = ["C" ] if not numeric_only else []
2721+ columns = ["C" ] if not numeric_only else Index ([], dtype = "str" )
27242722 else :
27252723 index = RangeIndex (0 )
27262724 columns = ["A" , "B" , "C" ] if not numeric_only else ["A" , "B" ]
27272725 expected = DataFrame ([], columns = columns , index = index )
27282726 tm .assert_frame_equal (result , expected )
27292727
27302728
2731- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
27322729def test_groupby_aggregation_non_numeric_dtype ():
27332730 # GH #43108
27342731 df = DataFrame (
@@ -2739,7 +2736,7 @@ def test_groupby_aggregation_non_numeric_dtype():
27392736 {
27402737 "v" : [[1 , 1 ], [10 , 20 ]],
27412738 },
2742- index = Index (["M" , "W" ], dtype = "object" , name = "MW" ),
2739+ index = Index (["M" , "W" ], name = "MW" ),
27432740 )
27442741
27452742 gb = df .groupby (by = ["MW" ])
0 commit comments