@@ -1617,7 +1617,6 @@ def test_groupby_two_group_keys_all_nan():
1617
1617
assert result == {}
1618
1618
1619
1619
1620
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
1621
1620
def test_groupby_2d_malformed ():
1622
1621
d = DataFrame (index = range (2 ))
1623
1622
d ["group" ] = ["g1" , "g2" ]
@@ -1626,7 +1625,7 @@ def test_groupby_2d_malformed():
1626
1625
d ["label" ] = ["l1" , "l2" ]
1627
1626
tmp = d .groupby (["group" ]).mean (numeric_only = True )
1628
1627
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 ))
1630
1629
tm .assert_numpy_array_equal (tmp .values , res_values )
1631
1630
1632
1631
@@ -2711,7 +2710,6 @@ def test_groupby_all_nan_groups_drop():
2711
2710
tm .assert_series_equal (result , expected )
2712
2711
2713
2712
2714
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" , strict = False )
2715
2713
@pytest .mark .parametrize ("numeric_only" , [True , False ])
2716
2714
def test_groupby_empty_multi_column (as_index , numeric_only ):
2717
2715
# GH 15106 & GH 41998
@@ -2720,15 +2718,14 @@ def test_groupby_empty_multi_column(as_index, numeric_only):
2720
2718
result = gb .sum (numeric_only = numeric_only )
2721
2719
if as_index :
2722
2720
index = MultiIndex ([[], []], [[], []], names = ["A" , "B" ])
2723
- columns = ["C" ] if not numeric_only else []
2721
+ columns = ["C" ] if not numeric_only else Index ([], dtype = "str" )
2724
2722
else :
2725
2723
index = RangeIndex (0 )
2726
2724
columns = ["A" , "B" , "C" ] if not numeric_only else ["A" , "B" ]
2727
2725
expected = DataFrame ([], columns = columns , index = index )
2728
2726
tm .assert_frame_equal (result , expected )
2729
2727
2730
2728
2731
- @pytest .mark .xfail (using_string_dtype (), reason = "TODO(infer_string)" )
2732
2729
def test_groupby_aggregation_non_numeric_dtype ():
2733
2730
# GH #43108
2734
2731
df = DataFrame (
@@ -2739,7 +2736,7 @@ def test_groupby_aggregation_non_numeric_dtype():
2739
2736
{
2740
2737
"v" : [[1 , 1 ], [10 , 20 ]],
2741
2738
},
2742
- index = Index (["M" , "W" ], dtype = "object" , name = "MW" ),
2739
+ index = Index (["M" , "W" ], name = "MW" ),
2743
2740
)
2744
2741
2745
2742
gb = df .groupby (by = ["MW" ])
0 commit comments