Skip to content

Commit 55a6d0a

Browse files
authored
TST(string dtype): Resolve xfail when grouping by nan column (#60712)
1 parent 7415aca commit 55a6d0a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pandas/tests/groupby/test_groupby.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import numpy as np
77
import pytest
88

9-
from pandas._config import using_string_dtype
10-
119
from pandas.errors import SpecificationError
1210
import pandas.util._test_decorators as td
1311

@@ -2468,12 +2466,13 @@ def test_groupby_none_in_first_mi_level():
24682466
tm.assert_series_equal(result, expected)
24692467

24702468

2471-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
2472-
def test_groupby_none_column_name():
2469+
def test_groupby_none_column_name(using_infer_string):
24732470
# GH#47348
24742471
df = DataFrame({None: [1, 1, 2, 2], "b": [1, 1, 2, 3], "c": [4, 5, 6, 7]})
2475-
result = df.groupby(by=[None]).sum()
2476-
expected = DataFrame({"b": [2, 5], "c": [9, 13]}, index=Index([1, 2], name=None))
2472+
by = [np.nan] if using_infer_string else [None]
2473+
gb = df.groupby(by=by)
2474+
result = gb.sum()
2475+
expected = DataFrame({"b": [2, 5], "c": [9, 13]}, index=Index([1, 2], name=by[0]))
24772476
tm.assert_frame_equal(result, expected)
24782477

24792478

0 commit comments

Comments
 (0)