Skip to content

Commit

Permalink
test_pivot_index_is_none
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Nov 18, 2024
1 parent 888d5cb commit 181c7e5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pandas/tests/reshape/test_pivot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2682,15 +2682,15 @@ def test_pivot_columns_is_none(self):
expected = DataFrame({1: 3}, index=Index([2], name="b"))
tm.assert_frame_equal(result, expected)

@pytest.mark.xfail(
using_string_dtype(), reason="TODO(infer_string) None is cast to NaN"
)
def test_pivot_index_is_none(self):
# GH#48293
df = DataFrame({None: [1], "b": 2, "c": 3})
df = DataFrame([[1, 2, 3]], columns=Index([None, "b", "c"], dtype="object"))

result = df.pivot(columns="b", index=None)
expected = DataFrame({("c", 2): 3}, index=[1])
expected.columns = expected.columns.set_levels(
expected.columns.levels[0].astype(object), level=0
)
expected.columns.names = [None, "b"]
tm.assert_frame_equal(result, expected)

Expand Down

0 comments on commit 181c7e5

Please sign in to comment.