Skip to content

Commit 3d72a09

Browse files
restructure to focus on string dtype changes/fixes
1 parent f0898cb commit 3d72a09

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

doc/source/whatsnew/v2.3.1.rst

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,12 @@ including other versions of pandas.
99
{{ header }}
1010

1111
.. ---------------------------------------------------------------------------
12-
.. _whatsnew_231.enhancements:
13-
14-
Enhancements
15-
~~~~~~~~~~~~
16-
-
17-
18-
.. ---------------------------------------------------------------------------
19-
.. _whatsnew_231.notable_bug_fixes:
20-
21-
Notable bug fixes
22-
~~~~~~~~~~~~~~~~~
23-
24-
These are bug fixes that might have notable behavior changes.
12+
.. _whatsnew_231.string_fixes:
2513

14+
Improvements and fixes for the StringDtype
15+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2616

27-
.. _whatsnew_231.notable_bug_fixes.string_comparisons:
17+
.. _whatsnew_231.string_fixes.string_comparisons:
2818

2919
Comparisons between different string dtypes
3020
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -39,16 +29,36 @@ in determining the result dtype when there are different string dtypes compared.
3929
- When ``pd.StringDtype("python", na_value=pd.NA)`` is compared against ``pd.StringDtype("pyarrow", na_value=np.nan)``, the result will be ``boolean``, the NumPy-backed nullable extension array.
4030
- When ``pd.StringDtype("python", na_value=pd.NA)`` is compared against ``pd.StringDtype("python", na_value=np.nan)``, the result will be ``boolean``, the NumPy-backed nullable extension array.
4131

32+
.. _whatsnew_231.string_fixes.ignore_empty:
33+
34+
Index set operations ignore empty RangeIndex and object dtype Index
35+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36+
37+
When enabling the ``future.infer_string`` option, :class:`Index` set operations (like
38+
union or intersection) will now ignore the dtype of an empty :class:`RangeIndex` or
39+
empty :class:`Index` with ``object`` dtype when determining the dtype of the resulting
40+
Index (:issue:`60797`).
4241

43-
.. _whatsnew_231.api_changes:
42+
This ensures that combining such empty Index with strings will infer the string dtype
43+
correctly, rather than defaulting to ``object`` dtype. For example:
4444

45-
API changes
46-
~~~~~~~~~~~
45+
.. code-block:: python
4746
48-
- When enabling the ``future.infer_string`` option, :class:`Index` set operations (like
49-
union or intersection) will now ignore the dtype of an empty :class:`RangeIndex` or
50-
empty :class:`Index` with ``object`` dtype when determining the dtype of the resulting
51-
Index (:issue:`60797`)
47+
>>> pd.options.mode.infer_string = True
48+
>>> df = pd.DataFrame()
49+
>>> df.columns.dtype
50+
dtype('int64') # default RangeIndex for empty columns
51+
>>> df["a"] = [1, 2, 3]
52+
>>> df.columns.dtype
53+
<StringDtype(na_value=nan)> # new columns use string dtype instead of object dtype
54+
55+
.. _whatsnew_231.string_fixes.bugs:
56+
57+
Bug fixes
58+
^^^^^^^^^
59+
- Bug in :meth:`.DataFrameGroupBy.min`, :meth:`.DataFrameGroupBy.max`, :meth:`.Resampler.min`, :meth:`.Resampler.max` where all NA values of string dtype would return float instead of string dtype (:issue:`60810`)
60+
- Bug in :meth:`DataFrame.sum` with ``axis=1``, :meth:`.DataFrameGroupBy.sum` or :meth:`.SeriesGroupBy.sum` with ``skipna=True``, and :meth:`.Resampler.sum` with all NA values of :class:`StringDtype` resulted in ``0`` instead of the empty string ``""`` (:issue:`60229`)
61+
- Fixed bug in :meth:`DataFrame.explode` and :meth:`Series.explode` where methods would fail with ``dtype="str"`` (:issue:`61623`)
5262

5363

5464
.. _whatsnew_231.regressions:
@@ -62,9 +72,7 @@ Fixed regressions
6272

6373
Bug fixes
6474
~~~~~~~~~
65-
- Bug in :meth:`.DataFrameGroupBy.min`, :meth:`.DataFrameGroupBy.max`, :meth:`.Resampler.min`, :meth:`.Resampler.max` where all NA values of string dtype would return float instead of string dtype (:issue:`60810`)
66-
- Bug in :meth:`DataFrame.sum` with ``axis=1``, :meth:`.DataFrameGroupBy.sum` or :meth:`.SeriesGroupBy.sum` with ``skipna=True``, and :meth:`.Resampler.sum` with all NA values of :class:`StringDtype` resulted in ``0`` instead of the empty string ``""`` (:issue:`60229`)
67-
- Fixed bug in :meth:`DataFrame.explode` and :meth:`Series.explode` where methods would fail with ``dtype="str"`` (:issue:`61623`)
75+
-
6876

6977
.. ---------------------------------------------------------------------------
7078
.. _whatsnew_231.other:

0 commit comments

Comments
 (0)