From 181c7e5d5ff795f7941492d34aa5e2220cfe020a Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 18 Nov 2024 16:50:37 +0000 Subject: [PATCH] test_pivot_index_is_none --- pandas/tests/reshape/test_pivot.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index d8a9acdc561fd..580842e919667 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -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)