Skip to content

Commit

Permalink
[backport 2.3.x] TST(string dtype): Resolve xfail when grouping by na…
Browse files Browse the repository at this point in the history
…n column (#60712) (#60719)

TST(string dtype): Resolve xfail when grouping by nan column (#60712)

(cherry picked from commit 55a6d0a)
  • Loading branch information
rhshadrach authored Jan 14, 2025
1 parent e90bb0e commit 7374d09
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import numpy as np
import pytest

from pandas._config import using_string_dtype

from pandas.errors import (
PerformanceWarning,
SpecificationError,
Expand Down Expand Up @@ -2876,12 +2874,13 @@ def test_groupby_none_in_first_mi_level():
tm.assert_series_equal(result, expected)


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


Expand Down

0 comments on commit 7374d09

Please sign in to comment.