Skip to content

Commit 7374d09

Browse files
authored
[backport 2.3.x] TST(string dtype): Resolve xfail when grouping by nan column (#60712) (#60719)
TST(string dtype): Resolve xfail when grouping by nan column (#60712) (cherry picked from commit 55a6d0a)
1 parent e90bb0e commit 7374d09

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 (
1210
PerformanceWarning,
1311
SpecificationError,
@@ -2876,12 +2874,13 @@ def test_groupby_none_in_first_mi_level():
28762874
tm.assert_series_equal(result, expected)
28772875

28782876

2879-
@pytest.mark.xfail(using_string_dtype(), reason="TODO(infer_string)")
2880-
def test_groupby_none_column_name():
2877+
def test_groupby_none_column_name(using_infer_string):
28812878
# GH#47348
28822879
df = DataFrame({None: [1, 1, 2, 2], "b": [1, 1, 2, 3], "c": [4, 5, 6, 7]})
2883-
result = df.groupby(by=[None]).sum()
2884-
expected = DataFrame({"b": [2, 5], "c": [9, 13]}, index=Index([1, 2], name=None))
2880+
by = [np.nan] if using_infer_string else [None]
2881+
gb = df.groupby(by=by)
2882+
result = gb.sum()
2883+
expected = DataFrame({"b": [2, 5], "c": [9, 13]}, index=Index([1, 2], name=by[0]))
28852884
tm.assert_frame_equal(result, expected)
28862885

28872886

0 commit comments

Comments
 (0)