@@ -983,18 +983,11 @@ def test_groupby_with_hier_columns():
983
983
tm .assert_index_equal (result .columns , df .columns [:- 1 ])
984
984
985
985
986
- def test_grouping_ndarray (df , using_infer_string ):
986
+ def test_grouping_ndarray (df ):
987
+ df = df .astype ({"A" : object , "B" : object })
987
988
grouped = df .groupby (df ["A" ].values )
988
989
grouped2 = df .groupby (df ["A" ].rename (None ))
989
990
990
- if using_infer_string :
991
- msg = "dtype 'str' does not support operation 'sum'"
992
- with pytest .raises (TypeError , match = msg ):
993
- grouped .sum ()
994
- with pytest .raises (TypeError , match = msg ):
995
- grouped2 .sum ()
996
- return
997
-
998
991
result = grouped .sum ()
999
992
expected = grouped2 .sum ()
1000
993
tm .assert_frame_equal (result , expected )
@@ -1495,18 +1488,11 @@ def f(group):
1495
1488
assert names == expected_names
1496
1489
1497
1490
1498
- def test_no_dummy_key_names (df , using_infer_string ):
1491
+ def test_no_dummy_key_names (df ):
1499
1492
# see gh-1291
1493
+ df = df .astype ({"A" : object , "B" : object })
1500
1494
gb = df .groupby (df ["A" ].values )
1501
1495
gb2 = df .groupby ([df ["A" ].values , df ["B" ].values ])
1502
- if using_infer_string :
1503
- msg = "dtype 'str' does not support operation 'sum'"
1504
- with pytest .raises (TypeError , match = msg ):
1505
- gb .sum ()
1506
- with pytest .raises (TypeError , match = msg ):
1507
- gb2 .sum ()
1508
- return
1509
-
1510
1496
result = gb .sum ()
1511
1497
assert result .index .name is None
1512
1498
0 commit comments