diff --git a/doc/source/whatsnew/v2.3.0.rst b/doc/source/whatsnew/v2.3.0.rst index 9e0e095eb4de8..98410e483aae3 100644 --- a/doc/source/whatsnew/v2.3.0.rst +++ b/doc/source/whatsnew/v2.3.0.rst @@ -95,7 +95,7 @@ Timezones Numeric ^^^^^^^ -- +- Enabled :class:`Series.mode` and :class:`DataFrame.mode` with ``dropna=False`` to sort the result for all dtypes in the presence of NA values; previously only certain dtypes would sort (:issue:`60702`) - Conversion diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index 374d236c8ff39..f0b43fdc5fae4 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -9,8 +9,6 @@ import numpy as np import pytest -from pandas._config import using_string_dtype - from pandas.compat.numpy import np_version_gte1p25 import pandas as pd @@ -2670,10 +2668,10 @@ def test_pivot_columns_not_given(self): # this still fails because columns=None gets passed down to unstack as level=None # while at that point None was converted to NaN - @pytest.mark.xfail( - using_string_dtype(), reason="TODO(infer_string) None is cast to NaN" - ) - def test_pivot_columns_is_none(self): + # @pytest.mark.xfail( + # using_string_dtype(), reason="TODO(infer_string) None is cast to NaN" + # ) + def test_pivot_columns_is_none(self, using_infer_string): # GH#48293 df = DataFrame({None: [1], "b": 2, "c": 3}) result = df.pivot(columns=None) @@ -2686,6 +2684,8 @@ def test_pivot_columns_is_none(self): result = df.pivot(columns=None, index="b", values="c") expected = DataFrame({1: 3}, index=Index([2], name="b")) + if using_infer_string: + expected.columns.name = np.nan tm.assert_frame_equal(result, expected) def test_pivot_index_is_none(self, using_infer_string):