These are the changes in pandas 2.3.0. See :ref:`release` for a full changelog including other versions of pandas.
{{ header }}
- The semantics for the
copykeyword in__array__methods (i.e. called when usingnp.array()ornp.asarray()on pandas objects) has been updated to work correctly with NumPy >= 2 (:issue:`57739`) - :meth:`Series.str.decode` result now has
StringDtypewhenfuture.infer_stringis True (:issue:`60709`) - :meth:`~Series.to_hdf` and :meth:`~DataFrame.to_hdf` now round-trip with
StringDtype(:issue:`60663`) - Improved
reprof :class:`.NumpyExtensionArray` to account for NEP51 (:issue:`61085`) - The :meth:`Series.str.decode` has gained the argument
dtypeto control the dtype of the result (:issue:`60940`) - The :meth:`~Series.cumsum`, :meth:`~Series.cummin`, and :meth:`~Series.cummax` reductions are now implemented for
StringDtypecolumns (:issue:`60633`) - The :meth:`~Series.sum` reduction is now implemented for
StringDtypecolumns (:issue:`59853`)
These are bug fixes that might have notable behavior changes.
- When enabling the
future.infer_stringoption: Index set operations (like union or intersection) will now ignore the dtype of an emptyRangeIndexor emptyIndexwith object dtype when determining the dtype of the resulting Index (:issue:`60797`)
- Deprecated allowing non-
boolvalues fornain :meth:`.str.contains`, :meth:`.str.startswith`, and :meth:`.str.endswith` for dtypes that do not already disallow these (:issue:`59615`) - Deprecated the
"pyarrow_numpy"storage option for :class:`StringDtype` (:issue:`60152`)
- Enabled :class:`Series.mode` and :class:`DataFrame.mode` with
dropna=Falseto sort the result for all dtypes in the presence of NA values; previously only certain dtypes would sort (:issue:`60702`)
- Bug in :meth:`DataFrame.sum` with
axis=1, :meth:`.DataFrameGroupBy.sum` or :meth:`.SeriesGroupBy.sum` withskipna=True, and :meth:`.Resampler.sum` on :class:`StringDtype` with all NA values resulted in0and is now the empty string""(:issue:`60229`) - Bug in :meth:`Series.__pos__` and :meth:`DataFrame.__pos__` did not raise for :class:`StringDtype` with
storage="pyarrow"(:issue:`60710`) - Bug in :meth:`Series.rank` for :class:`StringDtype` with
storage="pyarrow"incorrectly returning integer results in case ofmethod="average"and raising an error if it would truncate results (:issue:`59768`) - Bug in :meth:`Series.replace` with :class:`StringDtype` when replacing with a non-string value was not upcasting to
objectdtype (:issue:`60282`) - Bug in :meth:`Series.str.replace` when
n < 0for :class:`StringDtype` withstorage="pyarrow"(:issue:`59628`) - Bug in
ser.str.slicewith negativestepwith :class:`ArrowDtype` and :class:`StringDtype` withstorage="pyarrow"giving incorrect results (:issue:`59710`) - Bug in the
centermethod on :class:`Series` and :class:`Index` objectstraccessors with pyarrow-backed dtype not matching the python behavior in corner cases with an odd number of fill characters (:issue:`54792`)
- Fixed bug in :meth:`Index.get_indexer` round-tripping through string dtype when
infer_stringis enabled (:issue:`55834`)
- :meth:`DataFrame.to_excel` was storing decimals as strings instead of numbers (:issue:`49598`)
- :meth:`DataFrame.to_stata` no longer throws a
TypeError('encoding without a string argument')when exporting a column containing both long strings (Stata strL) and :class:`pd.NA` values (:issue:`23633`)
- Fixed usage of
inspectwhen the optional dependenciespyarroworjinja2are not installed (:issue:`60196`)