These are the changes in pandas 2.1.0. See :ref:`release` for a full changelog including other versions of pandas.
{{ header }}
- Improve error message when setting :class:`DataFrame` with wrong number of columns through :meth:`DataFrame.isetitem` (:issue:`51701`)
- Let :meth:`DataFrame.to_feather` accept a non-default :class:`Index` and non-string column names (:issue:`51787`)
These are bug fixes that might have notable behavior changes.
Some minimum supported versions of dependencies were updated. If installed, we now require:
Package | Minimum Version | Required | Changed |
---|---|---|---|
X | X |
For optional libraries the general recommendation is to use the latest version. The following table lists the lowest version per library that is currently being tested throughout the development of pandas. Optional libraries below the lowest tested version may still work, but are not considered supported.
Package | Minimum Version | Changed |
---|---|---|
X |
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
- Deprecating pinning
group.name
to each group in :meth:`SeriesGroupBy.aggregate` aggregations; if your operation requires utilizing the groupby keys, iterate over the groupby object instead (:issue:`41090`) - Deprecated
axis=1
in :meth:`DataFrame.groupby` and in :class:`Grouper` constructor, doframe.T.groupby(...)
instead (:issue:`51203`) - Deprecated passing a :class:`DataFrame` to :meth:`DataFrame.from_records`, use :meth:`DataFrame.set_index` or :meth:`DataFrame.drop` instead (:issue:`51353`)
- Deprecated accepting slices in :meth:`DataFrame.take`, call
obj[slicer]
or pass a sequence of integers instead (:issue:`51539`)
- Performance improvement in :func:`read_parquet` on string columns when using
use_nullable_dtypes=True
(:issue:`47345`) - Performance improvement in :meth:`DataFrame.clip` and :meth:`Series.clip` (:issue:`51472`)
- Performance improvement in :meth:`DataFrame.first_valid_index` and :meth:`DataFrame.last_valid_index` for extension array dtypes (:issue:`51549`)
- Performance improvement in :meth:`DataFrame.where` when
cond
is backed by an extension dtype (:issue:`51574`) - Performance improvement in :meth:`read_orc` when reading a remote URI file path. (:issue:`51609`)
- Performance improvement in :meth:`~arrays.ArrowExtensionArray.isna` when array has zero nulls or is all nulls (:issue:`51630`)
- Bug in :meth:`Timestamp.round` with values close to the implementation bounds returning incorrect results instead of raising
OutOfBoundsDatetime
(:issue:`51494`)
- Bug in :meth:`Timedelta.round` with values close to the implementation bounds returning incorrect results instead of raising
OutOfBoundsTimedelta
(:issue:`51494`) - Bug in :class:`TimedeltaIndex` division or multiplication leading to
.freq
of "0 Days" instead ofNone
(:issue:`51575`)
- Bug in :meth:`Series.corr` and :meth:`Series.cov` raising
AttributeError
for masked dtypes (:issue:`51422`)
- Bug in :class:`PeriodDtype` constructor failing to raise
TypeError
when no argument is passed or whenNone
is passed (:issue:`27388`) - Bug in :class:`PeriodDtype` constructor raising
ValueError
instead ofTypeError
when an invalid type is passed (:issue:`51790`)
Groupby - Bug in :meth:`GroupBy.mean`, :meth:`GroupBy.median`, :meth:`GroupBy.std`, :meth:`GroupBy.var`, :meth:`GroupBy.sem`, :meth:`GroupBy.prod`, :meth:`GroupBy.min`, :meth:`GroupBy.max` don't use corresponding methods of subclasses of :class:`Series` or :class:`DataFrame` (:issue:`51757`) -
- Bug in :meth:`DataFrameGroupBy.idxmin`, :meth:`SeriesGroupBy.idxmin`, :meth:`DataFrameGroupBy.idxmax`, :meth:`SeriesGroupBy.idxmax` return wrong dtype when used on empty DataFrameGroupBy or SeriesGroupBy (:issue:`51423`)
- Bug in weighted rolling aggregations when specifying
min_periods=0
(:issue:`51449`)
- Bug in :meth:`Series.any` and :meth:`Series.all` returning
NA
for empty or all null pyarrow-backed data whenskipna=True
(:issue:`51624`)