These are the changes in pandas 3.0.0. See :ref:`release` for a full changelog including other versions of pandas.
{{ header }}
- :class:`pandas.api.typing.FrozenList` is available for typing the outputs of :attr:`MultiIndex.names`, :attr:`MultiIndex.codes` and :attr:`MultiIndex.levels` (:issue:`58237`)
- :class:`pandas.api.typing.SASReader` is available for typing the output of :func:`read_sas` (:issue:`55689`)
- :meth:`pandas.api.interchange.from_dataframe` now uses the PyCapsule Interface if available, only falling back to the Dataframe Interchange Protocol if that fails (:issue:`60739`)
- Added :meth:`.Styler.to_typst` to write Styler objects to file, buffer or string in Typst format (:issue:`57617`)
- Added missing :meth:`pandas.Series.info` to API reference (:issue:`60926`)
- :class:`pandas.api.typing.NoDefault` is available for typing
no_default
- :func:`DataFrame.to_excel` now raises an
UserWarning
when the character count in a cell exceeds Excel's limitation of 32767 characters (:issue:`56954`) - :func:`pandas.merge` now validates the
how
parameter input (merge type) (:issue:`59435`) - :func:`pandas.merge`, :meth:`DataFrame.merge` and :meth:`DataFrame.join` now support anti joins (
left_anti
andright_anti
) in thehow
parameter (:issue:`42916`) - :func:`read_spss` now supports kwargs to be passed to pyreadstat (:issue:`56356`)
- :func:`read_stata` now returns
datetime64
resolutions better matching those natively stored in the stata format (:issue:`55642`) - :meth:`DataFrame.agg` called with
axis=1
and afunc
which relabels the result index now raises aNotImplementedError
(:issue:`58807`). - :meth:`Index.get_loc` now accepts also subclasses of
tuple
as keys (:issue:`57922`) - :meth:`Styler.set_tooltips` provides alternative method to storing tooltips by using title attribute of td elements. (:issue:`56981`)
- Added missing parameter
weights
in :meth:`DataFrame.plot.kde` for the estimation of the PDF (:issue:`59337`) - Allow dictionaries to be passed to :meth:`pandas.Series.str.replace` via
pat
parameter (:issue:`51748`) - Support passing a :class:`Series` input to :func:`json_normalize` that retains the :class:`Series` :class:`Index` (:issue:`51452`)
- Support reading value labels from Stata 108-format (Stata 6) and earlier files (:issue:`58154`)
- Users can globally disable any
PerformanceWarning
by setting the optionmode.performance_warnings
toFalse
(:issue:`56920`) - :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
- :class:`.errors.DtypeWarning` improved to include column names when mixed data types are detected (:issue:`58174`)
- :class:`Rolling` and :class:`Expanding` now support
pipe
method (:issue:`57076`) - :class:`Series` now supports the Arrow PyCapsule Interface for export (:issue:`59518`)
- :func:`DataFrame.to_excel` argument
merge_cells
now accepts a value of"columns"
to only merge :class:`MultiIndex` column header header cells (:issue:`35384`) - :meth:`DataFrame.corrwith` now accepts
min_periods
as optional arguments, as in :meth:`DataFrame.corr` and :meth:`Series.corr` (:issue:`9490`) - :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a
numeric_only
parameter (:issue:`53072`) - :meth:`DataFrame.ewm` now allows
adjust=False
whentimes
is provided (:issue:`54328`) - :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept
value=None
; for non-object dtype the corresponding NA value will be used (:issue:`57723`) - :meth:`DataFrame.pivot_table` and :func:`pivot_table` now allow the passing of keyword arguments to
aggfunc
through**kwargs
(:issue:`57884`) - :meth:`DataFrame.to_json` now encodes
Decimal
as strings instead of floats (:issue:`60698`) - :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
- :meth:`Series.plot` now correctly handle the
ylabel
parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`) - :meth:`DataFrame.plot.scatter` argument
c
now accepts a column of strings, where rows with the same string are colored identically (:issue:`16827` and :issue:`16485`) - :class:`ArrowDtype` now supports
pyarrow.JsonType
(:issue:`60958`) - :class:`DataFrameGroupBy` and :class:`SeriesGroupBy` methods
sum
,mean
,median
,prod
,min
,max
,std
,var
andsem
now acceptskipna
parameter (:issue:`15675`) - :class:`Rolling` and :class:`Expanding` now support
nunique
(:issue:`26958`) - :class:`Rolling` and :class:`Expanding` now support aggregations
first
andlast
(:issue:`33155`) - :func:`read_parquet` accepts
to_pandas_kwargs
which are forwarded to :meth:`pyarrow.Table.to_pandas` which enables passing additional keywords to customize the conversion to pandas, such asmaps_as_pydicts
to read the Parquet map data type as python dictionaries (:issue:`56842`) - :meth:`.DataFrameGroupBy.transform`, :meth:`.SeriesGroupBy.transform`, :meth:`.DataFrameGroupBy.agg`, :meth:`.SeriesGroupBy.agg`, :meth:`.SeriesGroupBy.apply`, :meth:`.DataFrameGroupBy.apply` now support
kurt
(:issue:`40139`) - :meth:`DataFrame.apply` supports using third-party execution engines like the Bodo.ai JIT compiler (:issue:`60668`)
- :meth:`DataFrameGroupBy.transform`, :meth:`SeriesGroupBy.transform`, :meth:`DataFrameGroupBy.agg`, :meth:`SeriesGroupBy.agg`, :meth:`RollingGroupby.apply`, :meth:`ExpandingGroupby.apply`, :meth:`Rolling.apply`, :meth:`Expanding.apply`, :meth:`DataFrame.apply` with
engine="numba"
now supports positional arguments passed as kwargs (:issue:`58995`) - :meth:`Rolling.agg`, :meth:`Expanding.agg` and :meth:`ExponentialMovingWindow.agg` now accept :class:`NamedAgg` aggregations through
**kwargs
(:issue:`28333`) - :meth:`Series.map` can now accept kwargs to pass on to func (:issue:`59814`)
- :meth:`Series.nlargest` has improved performance when there are duplicate values in the index (:issue:`55767`)
- :meth:`Series.str.get_dummies` now accepts a
dtype
parameter to specify the dtype of the resulting DataFrame (:issue:`47872`) - :meth:`pandas.concat` will raise a
ValueError
whenignore_index=True
andkeys
is notNone
(:issue:`59274`) - :py:class:`frozenset` elements in pandas objects are now natively printed (:issue:`60690`)
- Add
"delete_rows"
option toif_exists
argument in :meth:`DataFrame.to_sql` deleting all records of the table before inserting data (:issue:`37210`). - Added half-year offset classes :class:`HalfYearBegin`, :class:`HalfYearEnd`, :class:`BHalfYearBegin` and :class:`BHalfYearEnd` (:issue:`60928`)
- Errors occurring during SQL I/O will now throw a generic :class:`.DatabaseError` instead of the raw Exception type from the underlying driver manager library (:issue:`60748`)
- Implemented :meth:`Series.str.isascii` and :meth:`Series.str.isascii` (:issue:`59091`)
- Improved deprecation message for offset aliases (:issue:`60820`)
- Multiplying two :class:`DateOffset` objects will now raise a
TypeError
instead of aRecursionError
(:issue:`59442`) - Restore support for reading Stata 104-format and enable reading 103-format dta files (:issue:`58554`)
- Support passing a :class:`Iterable[Hashable]` input to :meth:`DataFrame.drop_duplicates` (:issue:`59237`)
- Support reading Stata 102-format (Stata 1) dta files (:issue:`58978`)
- Support reading Stata 110-format (Stata 7) dta files (:issue:`47176`)
These are bug fixes that might have notable behavior changes.
A number of bugs have been fixed due to improved handling of unobserved groups (:issue:`55738`). All remarks in this section equally impact :class:`.SeriesGroupBy`.
In previous versions of pandas, a single grouping with :meth:`.DataFrameGroupBy.apply` or :meth:`.DataFrameGroupBy.agg` would pass the unobserved groups to the provided function, resulting in 0
below.
.. ipython:: python df = pd.DataFrame( { "key1": pd.Categorical(list("aabb"), categories=list("abc")), "key2": [1, 1, 1, 2], "values": [1, 2, 3, 4], } ) df gb = df.groupby("key1", observed=False) gb[["values"]].apply(lambda x: x.sum())
However this was not the case when using multiple groupings, resulting in NaN
below.
In [1]: gb = df.groupby(["key1", "key2"], observed=False)
In [2]: gb[["values"]].apply(lambda x: x.sum())
Out[2]:
values
key1 key2
a 1 3.0
2 NaN
b 1 3.0
2 4.0
c 1 NaN
2 NaN
Now using multiple groupings will also pass the unobserved groups to the provided function.
.. ipython:: python gb = df.groupby(["key1", "key2"], observed=False) gb[["values"]].apply(lambda x: x.sum())
Similarly:
- In previous versions of pandas the method :meth:`.DataFrameGroupBy.sum` would result in
0
for unobserved groups, but :meth:`.DataFrameGroupBy.prod`, :meth:`.DataFrameGroupBy.all`, and :meth:`.DataFrameGroupBy.any` would all result in NA values. Now these methods result in1
,True
, andFalse
respectively. - :meth:`.DataFrameGroupBy.groups` did not include unobserved groups and now does.
These improvements also fixed certain bugs in groupby:
- :meth:`.DataFrameGroupBy.agg` would fail when there are multiple groupings, unobserved groups, and
as_index=False
(:issue:`36698`) - :meth:`.DataFrameGroupBy.groups` with
sort=False
would sort groups; they now occur in the order they are observed (:issue:`56966`) - :meth:`.DataFrameGroupBy.nunique` would fail when there are multiple groupings, unobserved groups, and
as_index=False
(:issue:`52848`) - :meth:`.DataFrameGroupBy.sum` would have incorrect values when there are multiple groupings, unobserved groups, and non-numeric data (:issue:`43891`)
- :meth:`.DataFrameGroupBy.value_counts` would produce incorrect results when used with some categorical and some non-categorical groupings and
observed=False
(:issue:`56016`) - :meth:`Series.nlargest`
Converting a sequence of strings, datetime
objects, or np.datetime64
objects to
a datetime64
dtype now performs inference on the appropriate resolution (AKA unit) for the output dtype. This affects :class:`Series`, :class:`DataFrame`, :class:`Index`, :class:`DatetimeIndex`, and :func:`to_datetime`.
Previously, these would always give nanosecond resolution:
In [1]: dt = pd.Timestamp("2024-03-22 11:36").to_pydatetime()
In [2]: pd.to_datetime([dt]).dtype
Out[2]: dtype('<M8[ns]')
In [3]: pd.Index([dt]).dtype
Out[3]: dtype('<M8[ns]')
In [4]: pd.DatetimeIndex([dt]).dtype
Out[4]: dtype('<M8[ns]')
In [5]: pd.Series([dt]).dtype
Out[5]: dtype('<M8[ns]')
This now infers the unit microsecond unit "us" from the pydatetime object, matching the scalar :class:`Timestamp` behavior.
.. ipython:: python In [1]: dt = pd.Timestamp("2024-03-22 11:36").to_pydatetime() In [2]: pd.to_datetime([dt]).dtype In [3]: pd.Index([dt]).dtype In [4]: pd.DatetimeIndex([dt]).dtype In [5]: pd.Series([dt]).dtype
Similar when passed a sequence of np.datetime64
objects, the resolution of the passed objects will be retained (or for lower-than-second resolution, second resolution will be used).
When passing strings, the resolution will depend on the precision of the string, again matching the :class:`Timestamp` behavior. Previously:
In [2]: pd.to_datetime(["2024-03-22 11:43:01"]).dtype
Out[2]: dtype('<M8[ns]')
In [3]: pd.to_datetime(["2024-03-22 11:43:01.002"]).dtype
Out[3]: dtype('<M8[ns]')
In [4]: pd.to_datetime(["2024-03-22 11:43:01.002003"]).dtype
Out[4]: dtype('<M8[ns]')
In [5]: pd.to_datetime(["2024-03-22 11:43:01.002003004"]).dtype
Out[5]: dtype('<M8[ns]')
The inferred resolution now matches that of the input strings:
.. ipython:: python In [2]: pd.to_datetime(["2024-03-22 11:43:01"]).dtype In [3]: pd.to_datetime(["2024-03-22 11:43:01.002"]).dtype In [4]: pd.to_datetime(["2024-03-22 11:43:01.002003"]).dtype In [5]: pd.to_datetime(["2024-03-22 11:43:01.002003004"]).dtype
In cases with mixed-resolution inputs, the highest resolution is used:
In [2]: pd.to_datetime([pd.Timestamp("2024-03-22 11:43:01"), "2024-03-22 11:43:01.002"]).dtype
Out[2]: dtype('<M8[ns]')
Changed behavior in :meth:`DataFrame.value_counts` and :meth:`DataFrameGroupBy.value_counts` when sort=False
In previous versions of pandas, :meth:`DataFrame.value_counts` with sort=False
would sort the result by row labels (as was documented). This was nonintuitive and inconsistent with :meth:`Series.value_counts` which would maintain the order of the input. Now :meth:`DataFrame.value_counts` will maintain the order of the input.
.. ipython:: python df = pd.DataFrame( { "a": [2, 2, 2, 2, 1, 1, 1, 1], "b": [2, 1, 3, 1, 2, 3, 1, 1], } ) df
Old behavior
In [3]: df.value_counts(sort=False)
Out[3]:
a b
1 1 2
2 1
3 1
2 1 2
2 1
3 1
Name: count, dtype: int64
New behavior
.. ipython:: python df.value_counts(sort=False)
This change also applies to :meth:`.DataFrameGroupBy.value_counts`. Here, there are two options for sorting: one sort
passed to :meth:`DataFrame.groupby` and one passed directly to :meth:`.DataFrameGroupBy.value_counts`. The former will determine whether to sort the groups, the latter whether to sort the counts. All non-grouping columns will maintain the order of the input within groups.
Old behavior
In [5]: df.groupby("a", sort=True).value_counts(sort=False)
Out[5]:
a b
1 1 2
2 1
3 1
2 1 2
2 1
3 1
dtype: int64
New behavior
.. ipython:: python df.groupby("a", sort=True).value_counts(sort=False)
pandas 3.0.0 supports Python 3.10 and higher.
Some minimum supported versions of dependencies were updated. If installed, we now require:
Package | Minimum Version | Required | Changed |
---|---|---|---|
numpy | 1.23.5 | 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 | New Minimum Version |
---|---|
pytz | 2023.4 |
fastparquet | 2023.10.0 |
adbc-driver-postgresql | 0.10.0 |
mypy (dev) | 1.9.0 |
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
pandas now uses :py:mod:`zoneinfo` from the standard library as the default timezone implementation when passing a timezone string to various methods. (:issue:`34916`)
Old behavior:
In [1]: ts = pd.Timestamp(2024, 1, 1).tz_localize("US/Pacific")
In [2]: ts.tz
<DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>
New behavior:
.. ipython:: python ts = pd.Timestamp(2024, 1, 1).tz_localize("US/Pacific") ts.tz
pytz
timezone objects are still supported when passed directly, but they will no longer be returned by default
from string inputs. Moreover, pytz
is no longer a required dependency of pandas, but can be installed
with the pip extra pip install pandas[timezone]
.
Additionally, pandas no longer throws pytz
exceptions for timezone operations leading to ambiguous or nonexistent
times. These cases will now raise a ValueError
.
- 3rd party
py.path
objects are no longer explicitly supported in IO methods. Use :py:class:`pathlib.Path` objects instead (:issue:`57091`) - :func:`read_table`'s
parse_dates
argument defaults toNone
to improve consistency with :func:`read_csv` (:issue:`57476`) - All classes inheriting from builtin
tuple
(including types created with :func:`collections.namedtuple`) are now hashed and compared as builtintuple
during indexing operations (:issue:`57922`) - Made
dtype
a required argument in :meth:`ExtensionArray._from_sequence_of_strings` (:issue:`56519`) - Passing a :class:`Series` input to :func:`json_normalize` will now retain the :class:`Series` :class:`Index`, previously output had a new :class:`RangeIndex` (:issue:`51452`)
- Removed :meth:`Index.sort` which always raised a
TypeError
. This attribute is not defined and will raise anAttributeError
(:issue:`59283`) - Unused
dtype
argument has been removed from the :class:`MultiIndex` constructor (:issue:`60962`) - Updated :meth:`DataFrame.to_excel` so that the output spreadsheet has no styling. Custom styling can still be done using :meth:`Styler.to_excel` (:issue:`54154`)
- pickle and HDF (
.h5
) files created with Python 2 are no longer explicitly supported (:issue:`57387`) - pickled objects from pandas version less than
1.0.0
are no longer supported (:issue:`57155`) - when comparing the indexes in :func:`testing.assert_series_equal`, check_exact defaults to True if an :class:`Index` is of integer dtypes. (:issue:`57386`)
- Index set operations (like union or intersection) will now ignore the dtype of
an empty
RangeIndex
or emptyIndex
with object dtype when determining the dtype of the resulting Index (:issue:`60797`)
The copy
keyword argument in the following methods is deprecated and
will be removed in a future version:
- :meth:`DataFrame.truncate` / :meth:`Series.truncate`
- :meth:`DataFrame.tz_convert` / :meth:`Series.tz_convert`
- :meth:`DataFrame.tz_localize` / :meth:`Series.tz_localize`
- :meth:`DataFrame.infer_objects` / :meth:`Series.infer_objects`
- :meth:`DataFrame.align` / :meth:`Series.align`
- :meth:`DataFrame.astype` / :meth:`Series.astype`
- :meth:`DataFrame.reindex` / :meth:`Series.reindex`
- :meth:`DataFrame.reindex_like` / :meth:`Series.reindex_like`
- :meth:`DataFrame.set_axis` / :meth:`Series.set_axis`
- :meth:`DataFrame.to_period` / :meth:`Series.to_period`
- :meth:`DataFrame.to_timestamp` / :meth:`Series.to_timestamp`
- :meth:`DataFrame.rename` / :meth:`Series.rename`
- :meth:`DataFrame.transpose`
- :meth:`DataFrame.swaplevel`
- :meth:`DataFrame.merge` / :func:`pd.merge`
Copy-on-Write utilizes a lazy copy mechanism that defers copying the data until
necessary. Use .copy
to trigger an eager copy. The copy keyword has no effect
starting with 3.0, so it can be safely removed from your code.
- Deprecated :func:`core.internals.api.make_block`, use public APIs instead (:issue:`56815`)
- Deprecated :meth:`.DataFrameGroupby.corrwith` (:issue:`57158`)
- Deprecated :meth:`Timestamp.utcfromtimestamp`, use
Timestamp.fromtimestamp(ts, "UTC")
instead (:issue:`56680`) - Deprecated :meth:`Timestamp.utcnow`, use
Timestamp.now("UTC")
instead (:issue:`56680`) - Deprecated allowing non-keyword arguments in :meth:`DataFrame.all`, :meth:`DataFrame.min`, :meth:`DataFrame.max`, :meth:`DataFrame.sum`, :meth:`DataFrame.prod`, :meth:`DataFrame.mean`, :meth:`DataFrame.median`, :meth:`DataFrame.sem`, :meth:`DataFrame.var`, :meth:`DataFrame.std`, :meth:`DataFrame.skew`, :meth:`DataFrame.kurt`, :meth:`Series.all`, :meth:`Series.min`, :meth:`Series.max`, :meth:`Series.sum`, :meth:`Series.prod`, :meth:`Series.mean`, :meth:`Series.median`, :meth:`Series.sem`, :meth:`Series.var`, :meth:`Series.std`, :meth:`Series.skew`, and :meth:`Series.kurt`. (:issue:`57087`)
- Deprecated allowing non-keyword arguments in :meth:`Series.to_markdown` except
buf
. (:issue:`57280`) - Deprecated allowing non-keyword arguments in :meth:`Series.to_string` except
buf
. (:issue:`57280`) - Deprecated behavior of :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupBy.groups`, in a future version
groups
by one element list will return tuple instead of scalar. (:issue:`58858`) - Deprecated behavior of :meth:`Series.dt.to_pytimedelta`, in a future version this will return a :class:`Series` containing python
datetime.timedelta
objects instead of anndarray
of timedelta; this matches the behavior of other :meth:`Series.dt` properties. (:issue:`57463`) - Deprecated lowercase strings
d
,b
andc
denoting frequencies in :class:`Day`, :class:`BusinessDay` and :class:`CustomBusinessDay` in favour ofD
,B
andC
(:issue:`58998`) - Deprecated lowercase strings
w
,w-mon
,w-tue
, etc. denoting frequencies in :class:`Week` in favour ofW
,W-MON
,W-TUE
, etc. (:issue:`58998`) - Deprecated parameter
method
in :meth:`DataFrame.reindex_like` / :meth:`Series.reindex_like` (:issue:`58667`) - Deprecated strings
w
,d
,MIN
,MS
,US
andNS
denoting units in :class:`Timedelta` in favour ofW
,D
,min
,ms
,us
andns
(:issue:`59051`) - Deprecated using
epoch
date format in :meth:`DataFrame.to_json` and :meth:`Series.to_json`, useiso
instead. (:issue:`57063`)
Renamed the following offset aliases (:issue:`57986`):
offset | removed alias | new alias |
---|---|---|
:class:`MonthEnd` | M |
ME |
:class:`BusinessMonthEnd` | BM |
BME |
:class:`SemiMonthEnd` | SM |
SME |
:class:`CustomBusinessMonthEnd` | CBM |
CBME |
:class:`QuarterEnd` | Q |
QE |
:class:`BQuarterEnd` | BQ |
BQE |
:class:`YearEnd` | Y |
YE |
:class:`BYearEnd` | BY |
BYE |
- :class:`.DataFrameGroupBy.idxmin`, :class:`.DataFrameGroupBy.idxmax`, :class:`.SeriesGroupBy.idxmin`, and :class:`.SeriesGroupBy.idxmax` will now raise a
ValueError
when used withskipna=False
and an NA value is encountered (:issue:`10694`) - :func:`concat` no longer ignores empty objects when determining output dtypes (:issue:`39122`)
- :func:`concat` with all-NA entries no longer ignores the dtype of those entries when determining the result dtype (:issue:`40893`)
- :func:`read_excel`, :func:`read_json`, :func:`read_html`, and :func:`read_xml` no longer accept raw string or byte representation of the data. That type of data must be wrapped in a :py:class:`StringIO` or :py:class:`BytesIO` (:issue:`53767`)
- :func:`to_datetime` with a
unit
specified no longer parses strings into floats, instead parses them the same way as withoutunit
(:issue:`50735`) - :meth:`DataFrame.groupby` with
as_index=False
and aggregation methods will no longer exclude from the result the groupings that do not arise from the input (:issue:`49519`) - :meth:`ExtensionArray._reduce` now requires a
keepdims: bool = False
parameter in the signature (:issue:`52788`) - :meth:`Series.dt.to_pydatetime` now returns a :class:`Series` of :py:class:`datetime.datetime` objects (:issue:`52459`)
- :meth:`SeriesGroupBy.agg` no longer pins the name of the group to the input passed to the provided
func
(:issue:`51703`) - All arguments except
name
in :meth:`Index.rename` are now keyword only (:issue:`56493`) - All arguments except the first
path
-like argument in IO writers are now keyword only (:issue:`54229`) - Changed behavior of :meth:`Series.__getitem__` and :meth:`Series.__setitem__` to always treat integer keys as labels, never as positional, consistent with :class:`DataFrame` behavior (:issue:`50617`)
- Changed behavior of :meth:`Series.__getitem__`, :meth:`Series.__setitem__`, :meth:`DataFrame.__getitem__`, :meth:`DataFrame.__setitem__` with an integer slice on objects with a floating-dtype index. This is now treated as positional indexing (:issue:`49612`)
- Disallow a callable argument to :meth:`Series.iloc` to return a
tuple
(:issue:`53769`) - Disallow allowing logical operations (
||
,&
,^
) between pandas objects and dtype-less sequences (e.g.list
,tuple
); wrap the objects in :class:`Series`, :class:`Index`, ornp.array
first instead (:issue:`52264`) - Disallow automatic casting to object in :class:`Series` logical operations (
&
,^
,||
) between series with mismatched indexes and dtypes other thanobject
orbool
(:issue:`52538`) - Disallow calling :meth:`Series.replace` or :meth:`DataFrame.replace` without a
value
and with non-dict-liketo_replace
(:issue:`33302`) - Disallow constructing a :class:`arrays.SparseArray` with scalar data (:issue:`53039`)
- Disallow indexing an :class:`Index` with a boolean indexer of length zero, it now raises
ValueError
(:issue:`55820`) - Disallow non-standard (
np.ndarray
, :class:`Index`, :class:`ExtensionArray`, or :class:`Series`) to :func:`isin`, :func:`unique`, :func:`factorize` (:issue:`52986`) - Disallow passing a pandas type to :meth:`Index.view` (:issue:`55709`)
- Disallow units other than "s", "ms", "us", "ns" for datetime64 and timedelta64 dtypes in :func:`array` (:issue:`53817`)
- Removed "freq" keyword from :class:`PeriodArray` constructor, use "dtype" instead (:issue:`52462`)
- Removed 'fastpath' keyword in :class:`Categorical` constructor (:issue:`20110`)
- Removed 'kind' keyword in :meth:`Series.resample` and :meth:`DataFrame.resample` (:issue:`58125`)
- Removed
Block
,DatetimeTZBlock
,ExtensionBlock
,create_block_manager_from_blocks
frompandas.core.internals
andpandas.core.internals.api
(:issue:`55139`) - Removed alias :class:`arrays.PandasArray` for :class:`arrays.NumpyExtensionArray` (:issue:`53694`)
- Removed deprecated "method" and "limit" keywords from :meth:`Series.replace` and :meth:`DataFrame.replace` (:issue:`53492`)
- Removed extension test classes
BaseNoReduceTests
,BaseNumericReduceTests
,BaseBooleanReduceTests
(:issue:`54663`) - Removed the "closed" and "normalize" keywords in :meth:`DatetimeIndex.__new__` (:issue:`52628`)
- Removed the deprecated
delim_whitespace
keyword in :func:`read_csv` and :func:`read_table`, usesep=r"\s+"
instead (:issue:`55569`) - Require :meth:`SparseDtype.fill_value` to be a valid value for the :meth:`SparseDtype.subtype` (:issue:`53043`)
- Stopped automatically casting non-datetimelike values (mainly strings) in :meth:`Series.isin` and :meth:`Index.isin` with
datetime64
,timedelta64
, and :class:`PeriodDtype` dtypes (:issue:`53111`) - Stopped performing dtype inference in :class:`Index`, :class:`Series` and :class:`DataFrame` constructors when given a pandas object (:class:`Series`, :class:`Index`, :class:`ExtensionArray`), call
.infer_objects
on the input to keep the current behavior (:issue:`56012`) - Stopped performing dtype inference when setting a :class:`Index` into a :class:`DataFrame` (:issue:`56102`)
- Stopped performing dtype inference with in :meth:`Index.insert` with object-dtype index; this often affects the index/columns that result when setting new entries into an empty :class:`Series` or :class:`DataFrame` (:issue:`51363`)
- Removed the "closed" and "unit" keywords in :meth:`TimedeltaIndex.__new__` (:issue:`52628`, :issue:`55499`)
- All arguments in :meth:`Index.sort_values` are now keyword only (:issue:`56493`)
- All arguments in :meth:`Series.to_dict` are now keyword only (:issue:`56493`)
- Changed the default value of
na_action
in :meth:`Categorical.map` toNone
(:issue:`51645`) - Changed the default value of
observed
in :meth:`DataFrame.groupby` and :meth:`Series.groupby` toTrue
(:issue:`51811`) - Enforce deprecation in :func:`testing.assert_series_equal` and :func:`testing.assert_frame_equal` with object dtype and mismatched null-like values, which are now considered not-equal (:issue:`18463`)
- Enforce banning of upcasting in in-place setitem-like operations (:issue:`59007`) (see PDEP6)
- Enforced deprecation
all
andany
reductions withdatetime64
, :class:`DatetimeTZDtype`, and :class:`PeriodDtype` dtypes (:issue:`58029`) - Enforced deprecation disallowing
float
"periods" in :func:`date_range`, :func:`period_range`, :func:`timedelta_range`, :func:`interval_range`, (:issue:`56036`) - Enforced deprecation disallowing parsing datetimes with mixed time zones unless user passes
utc=True
to :func:`to_datetime` (:issue:`57275`) - Enforced deprecation in :meth:`Series.value_counts` and :meth:`Index.value_counts` with object dtype performing dtype inference on the
.index
of the result (:issue:`56161`) - Enforced deprecation of :meth:`.DataFrameGroupBy.get_group` and :meth:`.SeriesGroupBy.get_group` allowing the
name
argument to be a non-tuple when grouping by a list of length 1 (:issue:`54155`) - Enforced deprecation of :meth:`Series.interpolate` and :meth:`DataFrame.interpolate` for object-dtype (:issue:`57820`)
- Enforced deprecation of :meth:`offsets.Tick.delta`, use
pd.Timedelta(obj)
instead (:issue:`55498`) - Enforced deprecation of
axis=None
acting the same asaxis=0
in the DataFrame reductionssum
,prod
,std
,var
, andsem
, passingaxis=None
will now reduce over both axes; this is particularly the case when doing e.g.numpy.sum(df)
(:issue:`21597`) - Enforced deprecation of
core.internals
memberDatetimeTZBlock
(:issue:`58467`) - Enforced deprecation of
date_parser
in :func:`read_csv`, :func:`read_table`, :func:`read_fwf`, and :func:`read_excel` in favour ofdate_format
(:issue:`50601`) - Enforced deprecation of
keep_date_col
keyword in :func:`read_csv` (:issue:`55569`) - Enforced deprecation of
quantile
keyword in :meth:`.Rolling.quantile` and :meth:`.Expanding.quantile`, renamed toq
instead. (:issue:`52550`) - Enforced deprecation of argument
infer_datetime_format
in :func:`read_csv`, as a strict version of it is now the default (:issue:`48621`) - Enforced deprecation of combining parsed datetime columns in :func:`read_csv` in
parse_dates
(:issue:`55569`) - Enforced deprecation of non-standard (
np.ndarray
, :class:`ExtensionArray`, :class:`Index`, or :class:`Series`) argument to :func:`api.extensions.take` (:issue:`52981`) - Enforced deprecation of parsing system timezone strings to
tzlocal
, which depended on system timezone, pass the 'tz' keyword instead (:issue:`50791`) - Enforced deprecation of passing a dictionary to :meth:`SeriesGroupBy.agg` (:issue:`52268`)
- Enforced deprecation of string
AS
denoting frequency in :class:`YearBegin` and stringsAS-DEC
,AS-JAN
, etc. denoting annual frequencies with various fiscal year starts (:issue:`57793`) - Enforced deprecation of string
A
denoting frequency in :class:`YearEnd` and stringsA-DEC
,A-JAN
, etc. denoting annual frequencies with various fiscal year ends (:issue:`57699`) - Enforced deprecation of string
BAS
denoting frequency in :class:`BYearBegin` and stringsBAS-DEC
,BAS-JAN
, etc. denoting annual frequencies with various fiscal year starts (:issue:`57793`) - Enforced deprecation of string
BA
denoting frequency in :class:`BYearEnd` and stringsBA-DEC
,BA-JAN
, etc. denoting annual frequencies with various fiscal year ends (:issue:`57793`) - Enforced deprecation of strings
H
,BH
, andCBH
denoting frequencies in :class:`Hour`, :class:`BusinessHour`, :class:`CustomBusinessHour` (:issue:`59143`) - Enforced deprecation of strings
H
,BH
, andCBH
denoting units in :class:`Timedelta` (:issue:`59143`) - Enforced deprecation of strings
T
,L
,U
, andN
denoting frequencies in :class:`Minute`, :class:`Milli`, :class:`Micro`, :class:`Nano` (:issue:`57627`) - Enforced deprecation of strings
T
,L
,U
, andN
denoting units in :class:`Timedelta` (:issue:`57627`) - Enforced deprecation of the behavior of :func:`concat` when
len(keys) != len(objs)
would truncate to the shorter of the two. Now this raises aValueError
(:issue:`43485`) - Enforced deprecation of the behavior of :meth:`DataFrame.replace` and :meth:`Series.replace` with :class:`CategoricalDtype` that would introduce new categories. (:issue:`58270`)
- Enforced deprecation of the behavior of :meth:`Series.argsort` in the presence of NA values (:issue:`58232`)
- Enforced deprecation of values "pad", "ffill", "bfill", and "backfill" for :meth:`Series.interpolate` and :meth:`DataFrame.interpolate` (:issue:`57869`)
- Enforced deprecation removing :meth:`Categorical.to_list`, use
obj.tolist()
instead (:issue:`51254`) - Enforced silent-downcasting deprecation for :ref:`all relevant methods <whatsnew_220.silent_downcasting>` (:issue:`54710`)
- In :meth:`DataFrame.stack`, the default value of
future_stack
is nowTrue
; specifyingFalse
will raise aFutureWarning
(:issue:`55448`) - Iterating over a :class:`.DataFrameGroupBy` or :class:`.SeriesGroupBy` will return tuples of length 1 for the groups when grouping by
level
a list of length 1 (:issue:`50064`) - Methods
apply
,agg
, andtransform
will no longer replace NumPy functions (e.g.np.sum
) and built-in functions (e.g.min
) with the equivalent pandas implementation; use string aliases (e.g."sum"
and"min"
) if you desire to use the pandas implementation (:issue:`53974`) - Passing both
freq
andfill_value
in :meth:`DataFrame.shift` and :meth:`Series.shift` and :meth:`.DataFrameGroupBy.shift` now raises aValueError
(:issue:`54818`) - Removed :meth:`.DataFrameGroupBy.quantile` and :meth:`.SeriesGroupBy.quantile` supporting bool dtype (:issue:`53975`)
- Removed :meth:`DateOffset.is_anchored` and :meth:`offsets.Tick.is_anchored` (:issue:`56594`)
- Removed
DataFrame.applymap
,Styler.applymap
andStyler.applymap_index
(:issue:`52364`) - Removed
DataFrame.bool
andSeries.bool
(:issue:`51756`) - Removed
DataFrame.first
andDataFrame.last
(:issue:`53710`) - Removed
DataFrame.swapaxes
andSeries.swapaxes
(:issue:`51946`) - Removed
DataFrameGroupBy.grouper
andSeriesGroupBy.grouper
(:issue:`56521`) - Removed
DataFrameGroupby.fillna
andSeriesGroupBy.fillna`
(:issue:`55719`) - Removed
Index.format
, use :meth:`Index.astype` withstr
or :meth:`Index.map` with aformatter
function instead (:issue:`55439`) - Removed
Resample.fillna
(:issue:`55719`) - Removed
Series.__int__
andSeries.__float__
. Callint(Series.iloc[0])
orfloat(Series.iloc[0])
instead. (:issue:`51131`) - Removed
Series.ravel
(:issue:`56053`) - Removed
Series.view
(:issue:`56054`) - Removed
StataReader.close
(:issue:`49228`) - Removed
_data
from :class:`DataFrame`, :class:`Series`, :class:`.arrays.ArrowExtensionArray` (:issue:`52003`) - Removed
axis
argument from :meth:`DataFrame.groupby`, :meth:`Series.groupby`, :meth:`DataFrame.rolling`, :meth:`Series.rolling`, :meth:`DataFrame.resample`, and :meth:`Series.resample` (:issue:`51203`) - Removed
axis
argument from all groupby operations (:issue:`50405`) - Removed
convert_dtype
from :meth:`Series.apply` (:issue:`52257`) - Removed
method
,limit
fill_axis
andbroadcast_axis
keywords from :meth:`DataFrame.align` (:issue:`51968`) - Removed
pandas.api.types.is_interval
andpandas.api.types.is_period
, useisinstance(obj, pd.Interval)
andisinstance(obj, pd.Period)
instead (:issue:`55264`) - Removed
pandas.io.sql.execute
(:issue:`50185`) - Removed
pandas.value_counts
, use :meth:`Series.value_counts` instead (:issue:`53493`) - Removed
read_gbq
andDataFrame.to_gbq
. Usepandas_gbq.read_gbq
andpandas_gbq.to_gbq
instead https://pandas-gbq.readthedocs.io/en/latest/api.html (:issue:`55525`) - Removed
use_nullable_dtypes
from :func:`read_parquet` (:issue:`51853`) - Removed
year
,month
,quarter
,day
,hour
,minute
, andsecond
keywords in the :class:`PeriodIndex` constructor, use :meth:`PeriodIndex.from_fields` instead (:issue:`55960`) - Removed argument
limit
from :meth:`DataFrame.pct_change`, :meth:`Series.pct_change`, :meth:`.DataFrameGroupBy.pct_change`, and :meth:`.SeriesGroupBy.pct_change`; the argumentmethod
must be set toNone
and will be removed in a future version of pandas (:issue:`53520`) - Removed deprecated argument
obj
in :meth:`.DataFrameGroupBy.get_group` and :meth:`.SeriesGroupBy.get_group` (:issue:`53545`) - Removed deprecated behavior of :meth:`Series.agg` using :meth:`Series.apply` (:issue:`53325`)
- Removed deprecated keyword
method
on :meth:`Series.fillna`, :meth:`DataFrame.fillna` (:issue:`57760`) - Removed option
mode.use_inf_as_na
, convert inf entries toNaN
before instead (:issue:`51684`) - Removed support for :class:`DataFrame` in :meth:`DataFrame.from_records`(:issue:`51697`)
- Removed support for
errors="ignore"
in :func:`to_datetime`, :func:`to_timedelta` and :func:`to_numeric` (:issue:`55734`) - Removed support for
slice
in :meth:`DataFrame.take` (:issue:`51539`) - Removed the
ArrayManager
(:issue:`55043`) - Removed the
fastpath
argument from the :class:`Series` constructor (:issue:`55466`) - Removed the
is_boolean
,is_integer
,is_floating
,holds_integer
,is_numeric
,is_categorical
,is_object
, andis_interval
attributes of :class:`Index` (:issue:`50042`) - Removed the
ordinal
keyword in :class:`PeriodIndex`, use :meth:`PeriodIndex.from_ordinals` instead (:issue:`55960`) - Removed unused arguments
*args
and**kwargs
in :class:`Resampler` methods (:issue:`50977`) - Unrecognized timezones when parsing strings to datetimes now raises a
ValueError
(:issue:`51477`) - Removed the :class:`Grouper` attributes
ax
,groups
,indexer
, andobj
(:issue:`51206`, :issue:`51182`) - Removed deprecated keyword
verbose
on :func:`read_csv` and :func:`read_table` (:issue:`56556`) - Removed the
method
keyword inExtensionArray.fillna
, implementExtensionArray._pad_or_backfill
instead (:issue:`53621`) - Removed the attribute
dtypes
from :class:`.DataFrameGroupBy` (:issue:`51997`) - Enforced deprecation of
argmin
,argmax
,idxmin
, andidxmax
returning a result whenskipna=False
and an NA value is encountered or all values are NA values; these operations will now raise in such cases (:issue:`33941`, :issue:`51276`) - Removed specifying
include_groups=True
in :class:`.DataFrameGroupBy.apply` and :class:`.Resampler.apply` (:issue:`7155`)
- Eliminated circular reference in to original pandas object in accessor attributes (e.g. :attr:`Series.str`). However, accessor instantiation is no longer cached (:issue:`47667`, :issue:`41357`)
- :attr:`Categorical.categories` returns a :class:`RangeIndex` columns instead of an :class:`Index` if the constructed
values
was arange
. (:issue:`57787`) - :class:`DataFrame` returns a :class:`RangeIndex` columns when possible when
data
is adict
(:issue:`57943`) - :class:`Series` returns a :class:`RangeIndex` index when possible when
data
is adict
(:issue:`58118`) - :func:`concat` returns a :class:`RangeIndex` column when possible when
objs
contains :class:`Series` and :class:`DataFrame` andaxis=0
(:issue:`58119`) - :func:`concat` returns a :class:`RangeIndex` level in the :class:`MultiIndex` result when
keys
is arange
or :class:`RangeIndex` (:issue:`57542`) - :meth:`RangeIndex.append` returns a :class:`RangeIndex` instead of a :class:`Index` when appending values that could continue the :class:`RangeIndex` (:issue:`57467`)
- :meth:`Series.str.extract` returns a :class:`RangeIndex` columns instead of an :class:`Index` column when possible (:issue:`57542`)
- :meth:`Series.str.partition` with :class:`ArrowDtype` returns a :class:`RangeIndex` columns instead of an :class:`Index` column when possible (:issue:`57768`)
- Performance improvement in :class:`DataFrame` when
data
is adict
andcolumns
is specified (:issue:`24368`) - Performance improvement in :class:`MultiIndex` when setting :attr:`MultiIndex.names` doesn't invalidate all cached operations (:issue:`59578`)
- Performance improvement in :meth:`DataFrame.join` for sorted but non-unique indexes (:issue:`56941`)
- Performance improvement in :meth:`DataFrame.join` when left and/or right are non-unique and
how
is"left"
,"right"
, or"inner"
(:issue:`56817`) - Performance improvement in :meth:`DataFrame.join` with
how="left"
orhow="right"
andsort=True
(:issue:`56919`) - Performance improvement in :meth:`DataFrame.to_csv` when
index=False
(:issue:`59312`) - Performance improvement in :meth:`DataFrameGroupBy.ffill`, :meth:`DataFrameGroupBy.bfill`, :meth:`SeriesGroupBy.ffill`, and :meth:`SeriesGroupBy.bfill` (:issue:`56902`)
- Performance improvement in :meth:`Index.join` by propagating cached attributes in cases where the result matches one of the inputs (:issue:`57023`)
- Performance improvement in :meth:`Index.take` when
indices
is a full range indexer from zero to length of index (:issue:`56806`) - Performance improvement in :meth:`Index.to_frame` returning a :class:`RangeIndex` columns of a :class:`Index` when possible. (:issue:`58018`)
- Performance improvement in :meth:`MultiIndex._engine` to use smaller dtypes if possible (:issue:`58411`)
- Performance improvement in :meth:`MultiIndex.equals` for equal length indexes (:issue:`56990`)
- Performance improvement in :meth:`MultiIndex.memory_usage` to ignore the index engine when it isn't already cached. (:issue:`58385`)
- Performance improvement in :meth:`RangeIndex.__getitem__` with a boolean mask or integers returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57588`)
- Performance improvement in :meth:`RangeIndex.append` when appending the same index (:issue:`57252`)
- Performance improvement in :meth:`RangeIndex.argmin` and :meth:`RangeIndex.argmax` (:issue:`57823`)
- Performance improvement in :meth:`RangeIndex.insert` returning a :class:`RangeIndex` instead of a :class:`Index` when the :class:`RangeIndex` is empty. (:issue:`57833`)
- Performance improvement in :meth:`RangeIndex.round` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57824`)
- Performance improvement in :meth:`RangeIndex.searchsorted` (:issue:`58376`)
- Performance improvement in :meth:`RangeIndex.to_numpy` when specifying an
na_value
(:issue:`58376`) - Performance improvement in :meth:`RangeIndex.value_counts` (:issue:`58376`)
- Performance improvement in :meth:`RangeIndex.join` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57651`, :issue:`57752`)
- Performance improvement in :meth:`RangeIndex.reindex` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57647`, :issue:`57752`)
- Performance improvement in :meth:`RangeIndex.take` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57445`, :issue:`57752`)
- Performance improvement in :func:`merge` if hash-join can be used (:issue:`57970`)
- Performance improvement in :meth:`CategoricalDtype.update_dtype` when
dtype
is a :class:`CategoricalDtype` with nonNone
categories and ordered (:issue:`59647`) - Performance improvement in :meth:`DataFrame.__getitem__` when
key
is a :class:`DataFrame` with many columns (:issue:`61010`) - Performance improvement in :meth:`DataFrame.astype` when converting to extension floating dtypes, e.g. "Float64" (:issue:`60066`)
- Performance improvement in :meth:`DataFrame.where` when
cond
is a :class:`DataFrame` with many columns (:issue:`61010`) - Performance improvement in :meth:`to_hdf` avoid unnecessary reopenings of the HDF5 file to speedup data addition to files with a very large number of groups . (:issue:`58248`)
- Performance improvement in
DataFrameGroupBy.__len__
andSeriesGroupBy.__len__
(:issue:`57595`) - Performance improvement in indexing operations for string dtypes (:issue:`56997`)
- Performance improvement in unary methods on a :class:`RangeIndex` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57825`)
- Bug in :func:`Series.apply` where
nan
was ignored for :class:`CategoricalDtype` (:issue:`59938`) - Bug in :meth:`Series.convert_dtypes` with
dtype_backend="pyarrow"
where empty :class:`CategoricalDtype` :class:`Series` raised an error or got converted tonull[pyarrow]
(:issue:`59934`)
- Bug in :attr:`is_year_start` where a DateTimeIndex constructed via a date_range with frequency 'MS' wouldn't have the correct year or quarter start attributes (:issue:`57377`)
- Bug in :class:`DataFrame` raising
ValueError
whendtype
istimedelta64
anddata
is a list containingNone
(:issue:`60064`) - Bug in :class:`Timestamp` constructor failing to raise when
tz=None
is explicitly specified in conjunction with timezone-awaretzinfo
or data (:issue:`48688`) - Bug in :func:`date_range` where the last valid timestamp would sometimes not be produced (:issue:`56134`)
- Bug in :func:`date_range` where using a negative frequency value would not include all points between the start and end values (:issue:`56147`)
- Bug in :func:`tseries.api.guess_datetime_format` would fail to infer time format when "%Y" == "%H%M" (:issue:`57452`)
- Bug in :func:`tseries.frequencies.to_offset` would fail to parse frequency strings starting with "LWOM" (:issue:`59218`)
- Bug in :meth:`DataFrame.min` and :meth:`DataFrame.max` casting
datetime64
andtimedelta64
columns tofloat64
and losing precision (:issue:`60850`) - Bug in :meth:`Dataframe.agg` with df with missing values resulting in IndexError (:issue:`58810`)
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` does not raise on Custom business days frequencies bigger then "1C" (:issue:`58664`)
- Bug in :meth:`DatetimeIndex.is_year_start` and :meth:`DatetimeIndex.is_quarter_start` returning
False
on double-digit frequencies (:issue:`58523`) - Bug in :meth:`DatetimeIndex.union` and :meth:`DatetimeIndex.intersection` when
unit
was non-nanosecond (:issue:`59036`) - Bug in :meth:`Series.dt.microsecond` producing incorrect results for pyarrow backed :class:`Series`. (:issue:`59154`)
- Bug in :meth:`to_datetime` not respecting dayfirst if an uncommon date string was passed. (:issue:`58859`)
- Bug in :meth:`to_datetime` on float array with missing values throwing
FloatingPointError
(:issue:`58419`) - Bug in :meth:`to_datetime` on float32 df with year, month, day etc. columns leads to precision issues and incorrect result. (:issue:`60506`)
- Bug in :meth:`to_datetime` reports incorrect index in case of any failure scenario. (:issue:`58298`)
- Bug in :meth:`to_datetime` wrongly converts when
arg
is anp.datetime64
object with unit ofps
. (:issue:`60341`) - Bug in setting scalar values with mismatched resolution into arrays with non-nanosecond
datetime64
,timedelta64
or :class:`DatetimeTZDtype` incorrectly truncating those scalars (:issue:`56410`)
- Accuracy improvement in :meth:`Timedelta.to_pytimedelta` to round microseconds consistently for large nanosecond based Timedelta (:issue:`57841`)
- Bug in :meth:`DataFrame.cumsum` which was raising
IndexError
if dtype istimedelta64[ns]
(:issue:`57956`)
- Bug in :meth:`DataFrame.quantile` where the column type was not preserved when
numeric_only=True
with a list-likeq
produced an empty result (:issue:`59035`) - Bug in
np.matmul
with :class:`Index` inputs raising aTypeError
(:issue:`57079`)
- Bug in :meth:`DataFrame.astype` not casting
values
for Arrow-based dictionary dtype correctly (:issue:`58479`) - Bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
- Bug in :meth:`Series.astype` might modify read-only array inplace when casting to a string dtype (:issue:`57212`)
- Bug in :meth:`Series.convert_dtypes` and :meth:`DataFrame.convert_dtypes` removing timezone information for objects with :class:`ArrowDtype` (:issue:`60237`)
- Bug in :meth:`Series.reindex` not maintaining
float32
type when areindex
introduces a missing value (:issue:`45857`)
- Bug in :meth:`Series.value_counts` would not respect
sort=False
for series havingstring
dtype (:issue:`55224`)
- :meth:`Index.is_monotonic_decreasing`, :meth:`Index.is_monotonic_increasing`, and :meth:`Index.is_unique` could incorrectly be
False
for anIndex
created from a slice of anotherIndex
. (:issue:`57911`) - Bug in :func:`interval_range` where start and end numeric types were always cast to 64 bit (:issue:`57268`)
- Bug in :meth:`DataFrame.__getitem__` returning modified columns when called with
slice
in Python 3.12 (:issue:`57500`) - Bug in :meth:`DataFrame.__getitem__` when slicing a :class:`DataFrame` with many rows raised an
OverflowError
(:issue:`59531`) - Bug in :meth:`DataFrame.from_records` throwing a
ValueError
when passed an empty list inindex
(:issue:`58594`) - Bug in :meth:`DataFrame.loc` with inconsistent behavior of loc-set with 2 given indexes to Series (:issue:`59933`)
- Bug in :meth:`Index.get_indexer` and similar methods when
NaN
is located at or after position 128 (:issue:`58924`) - Bug in :meth:`MultiIndex.insert` when a new value inserted to a datetime-like level gets cast to
NaT
and fails indexing (:issue:`60388`) - Bug in printing :attr:`Index.names` and :attr:`MultiIndex.levels` would not escape single quotes (:issue:`60190`)
- Bug in reindexing of :class:`DataFrame` with :class:`PeriodDtype` columns in case of consolidated block (:issue:`60980`, :issue:`60273`)
- Bug in :meth:`DataFrame.fillna` and :meth:`Series.fillna` that would ignore the
limit
argument on :class:`.ExtensionArray` dtypes (:issue:`58001`)
- :func:`DataFrame.loc` with
axis=0
and :class:`MultiIndex` when setting a value adds extra columns (:issue:`58116`) - :meth:`DataFrame.melt` would not accept multiple names in
var_name
when the columns were a :class:`MultiIndex` (:issue:`58033`) - :meth:`MultiIndex.insert` would not insert NA value correctly at unified location of index -1 (:issue:`59003`)
- :func:`MultiIndex.get_level_values` accessing a :class:`DatetimeIndex` does not carry the frequency attribute along (:issue:`58327`, :issue:`57949`)
- Bug in :class:`DataFrame` arithmetic operations in case of unaligned MultiIndex columns (:issue:`60498`)
- Bug in :class:`DataFrame` arithmetic operations with :class:`Series` in case of unaligned MultiIndex (:issue:`61009`)
- Bug in :meth:`MultiIndex.from_tuples` causing wrong output with input of type tuples having NaN values (:issue:`60695`, :issue:`60988`)
- Bug in :class:`DataFrame` and :class:`Series`
repr
of :py:class:`collections.abc.Mapping`` elements. (:issue:`57915`) - Bug in :meth:`.DataFrame.to_json` when
"index"
was a value in the :attr:`DataFrame.column` and :attr:`Index.name` wasNone
. Now, this will fail with aValueError
(:issue:`58925`) - Bug in :meth:`.io.common.is_fsspec_url` not recognizing chained fsspec URLs (:issue:`48978`)
- Bug in :meth:`DataFrame._repr_html_` which ignored the
"display.float_format"
option (:issue:`59876`) - Bug in :meth:`DataFrame.from_records` where
columns
parameter with numpy structured array was not reordering and filtering out the columns (:issue:`59717`) - Bug in :meth:`DataFrame.to_dict` raises unnecessary
UserWarning
when columns are not unique andorient='tight'
. (:issue:`58281`) - Bug in :meth:`DataFrame.to_excel` when writing empty :class:`DataFrame` with :class:`MultiIndex` on both axes (:issue:`57696`)
- Bug in :meth:`DataFrame.to_excel` where the :class:`MultiIndex` index with a period level was not a date (:issue:`60099`)
- Bug in :meth:`DataFrame.to_stata` when writing :class:`DataFrame` and
byteorder=`big`
. (:issue:`58969`) - Bug in :meth:`DataFrame.to_stata` when writing more than 32,000 value labels. (:issue:`60107`)
- Bug in :meth:`DataFrame.to_string` that raised
StopIteration
with nested DataFrames. (:issue:`16098`) - Bug in :meth:`HDFStore.get` was failing to save data of dtype datetime64[s] correctly (:issue:`59004`)
- Bug in :meth:`read_csv` causing segmentation fault when
encoding_errors
is not a string. (:issue:`59059`) - Bug in :meth:`read_csv` raising
TypeError
whenindex_col
is specified andna_values
is a dict containing the keyNone
. (:issue:`57547`) - Bug in :meth:`read_csv` raising
TypeError
whennrows
anditerator
are specified without specifying achunksize
. (:issue:`59079`) - Bug in :meth:`read_csv` where the order of the
na_values
makes an inconsistency whenna_values
is a list non-string values. (:issue:`59303`) - Bug in :meth:`read_excel` raising
ValueError
when passing array of boolean values whendtype="boolean"
. (:issue:`58159`) - Bug in :meth:`read_html` where
rowspan
in header row causes incorrect conversion toDataFrame
. (:issue:`60210`) - Bug in :meth:`read_json` ignoring the given
dtype
whenengine="pyarrow"
(:issue:`59516`) - Bug in :meth:`read_json` not validating the
typ
argument to not be exactly"frame"
or"series"
(:issue:`59124`) - Bug in :meth:`read_json` where extreme value integers in string format were incorrectly parsed as a different integer number (:issue:`20608`)
- Bug in :meth:`read_stata` raising
KeyError
when input file is stored in big-endian format and contains strL data. (:issue:`58638`) - Bug in :meth:`read_stata` where extreme value integers were incorrectly interpreted as missing for format versions 111 and prior (:issue:`58130`)
- Bug in :meth:`read_stata` where the missing code for double was not recognised for format versions 105 and prior (:issue:`58149`)
- Bug in :meth:`set_option` where setting the pandas option
display.html.use_mathjax
toFalse
has no effect (:issue:`59884`) - Bug in :meth:`to_excel` where :class:`MultiIndex` columns would be merged to a single row when
merge_cells=False
is passed (:issue:`60274`)
- Fixed error message when passing invalid period alias to :meth:`PeriodIndex.to_timestamp` (:issue:`58974`)
- Bug in :meth:`.DataFrameGroupBy.boxplot` failed when there were multiple groupings (:issue:`14701`)
- Bug in :meth:`DataFrame.plot.bar` with
stacked=True
where labels on stacked bars with zero-height segments were incorrectly positioned at the base instead of the label position of the previous segment (:issue:`59429`) - Bug in :meth:`DataFrame.plot.line` raising
ValueError
when set both color and adict
style (:issue:`59461`) - Bug in :meth:`DataFrame.plot` that causes a shift to the right when the frequency multiplier is greater than one. (:issue:`57587`)
- Bug in :meth:`Series.plot` with
kind="pie"
with :class:`ArrowDtype` (:issue:`59192`)
- Bug in :meth:`.DataFrameGroupBy.__len__` and :meth:`.SeriesGroupBy.__len__` would raise when the grouping contained NA values and
dropna=False
(:issue:`58644`) - Bug in :meth:`.DataFrameGroupBy.any` that returned True for groups where all Timedelta values are NaT. (:issue:`59712`)
- Bug in :meth:`.DataFrameGroupBy.groups` and :meth:`.SeriesGroupby.groups` that would not respect groupby argument
dropna
(:issue:`55919`) - Bug in :meth:`.DataFrameGroupBy.median` where nat values gave an incorrect result. (:issue:`57926`)
- Bug in :meth:`.DataFrameGroupBy.quantile` when
interpolation="nearest"
is inconsistent with :meth:`DataFrame.quantile` (:issue:`47942`) - Bug in :meth:`.Resampler.interpolate` on a :class:`DataFrame` with non-uniform sampling and/or indices not aligning with the resulting resampled index would result in wrong interpolation (:issue:`21351`)
- Bug in :meth:`DataFrame.ewm` and :meth:`Series.ewm` when passed
times
and aggregation functions other than mean (:issue:`51695`) - Bug in :meth:`DataFrameGroupBy.agg` that raises
AttributeError
when there is dictionary input and duplicated columns, instead of returning a DataFrame with the aggregation of all duplicate columns. (:issue:`55041`) - Bug in :meth:`DataFrameGroupBy.apply` and :meth:`SeriesGroupBy.apply` for empty data frame with
group_keys=False
still creating output index using group keys. (:issue:`60471`) - Bug in :meth:`DataFrameGroupBy.apply` that was returning a completely empty DataFrame when all return values of
func
wereNone
instead of returning an empty DataFrame with the original columns and dtypes. (:issue:`57775`) - Bug in :meth:`DataFrameGroupBy.apply` with
as_index=False
that was returning :class:`MultiIndex` instead of returning :class:`Index`. (:issue:`58291`) - Bug in :meth:`DataFrameGroupBy.cumsum` and :meth:`DataFrameGroupBy.cumprod` where
numeric_only
parameter was passed indirectly through kwargs instead of passing directly. (:issue:`58811`) - Bug in :meth:`DataFrameGroupBy.cumsum` where it did not return the correct dtype when the label contained
None
. (:issue:`58811`) - Bug in :meth:`DataFrameGroupby.transform` and :meth:`SeriesGroupby.transform` with a reducer and
observed=False
that coerces dtype to float when there are unobserved categories. (:issue:`55326`) - Bug in :meth:`Rolling.apply` for
method="table"
where column order was not being respected due to the columns getting sorted by default. (:issue:`59666`) - Bug in :meth:`Rolling.apply` where the applied function could be called on fewer than
min_period
periods ifmethod="table"
. (:issue:`58868`) - Bug in :meth:`Series.resample` could raise when the the date range ended shortly before a non-existent time. (:issue:`58380`)
- Bug in :func:`qcut` where values at the quantile boundaries could be incorrectly assigned (:issue:`59355`)
- Bug in :meth:`DataFrame.combine_first` not preserving the column order (:issue:`60427`)
- Bug in :meth:`DataFrame.explode` producing incorrect result for :class:`pyarrow.large_list` type (:issue:`61091`)
- Bug in :meth:`DataFrame.join` inconsistently setting result index name (:issue:`55815`)
- Bug in :meth:`DataFrame.join` when a :class:`DataFrame` with a :class:`MultiIndex` would raise an
AssertionError
when :attr:`MultiIndex.names` containedNone
. (:issue:`58721`) - Bug in :meth:`DataFrame.merge` where merging on a column containing only
NaN
values resulted in an out-of-bounds array access (:issue:`59421`) - Bug in :meth:`DataFrame.unstack` producing incorrect results when
sort=False
(:issue:`54987`, :issue:`55516`) - Bug in :meth:`DataFrame.merge` when merging two :class:`DataFrame` on
intc
oruintc
types on Windows (:issue:`60091`, :issue:`58713`) - Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an
index
argument (:issue:`58722`) - Bug in :meth:`DataFrame.stack` with the new implementation where
ValueError
is raised whenlevel=[]
(:issue:`60740`) - Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
- Bug in :meth:`concat` where concatenating DataFrame and Series with
ignore_index = True
drops the series name (:issue:`60723`, :issue:`56257`)
- Bug in :class:`SparseDtype` for equal comparison with na fill value. (:issue:`54770`)
- Bug in :meth:`DataFrame.sparse.from_spmatrix` which hard coded an invalid
fill_value
for certain subtypes. (:issue:`59063`) - Bug in :meth:`DataFrame.sparse.to_dense` which ignored subclassing and always returned an instance of :class:`DataFrame` (:issue:`59913`)
- Bug in :class:`Categorical` when constructing with an :class:`Index` with :class:`ArrowDtype` (:issue:`60563`)
- Bug in :meth:`.arrays.ArrowExtensionArray.__setitem__` which caused wrong behavior when using an integer array with repeated values as a key (:issue:`58530`)
- Bug in :meth:`ArrowExtensionArray.factorize` where NA values were dropped when input was dictionary-encoded even when dropna was set to False(:issue:`60567`)
- Bug in :meth:`api.types.is_datetime64_any_dtype` where a custom :class:`ExtensionDtype` would return
False
for array-likes (:issue:`57055`) - Bug in comparison between object with :class:`ArrowDtype` and incompatible-dtyped (e.g. string vs bool) incorrectly raising instead of returning all-
False
(for==
) or all-True
(for!=
) (:issue:`59505`) - Bug in constructing pandas data structures when passing into
dtype
a string of the type followed by[pyarrow]
while PyArrow is not installed would raiseNameError
rather thanImportError
(:issue:`57928`) - Bug in various :class:`DataFrame` reductions for pyarrow temporal dtypes returning incorrect dtype when result was null (:issue:`59234`)
- Bug in :meth:`Styler.to_latex` where styling column headers when combined with a hidden index or hidden index-levels is fixed.
- Bug in :class:`DataFrame` when passing a
dict
with a NA scalar andcolumns
that would always returnnp.nan
(:issue:`57205`) - Bug in :class:`Series` ignoring errors when trying to convert :class:`Series` input data to the given
dtype
(:issue:`60728`) - Bug in :func:`eval` on :class:`ExtensionArray` on including division
/
failed with aTypeError
. (:issue:`58748`) - Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using
engine="numexpr"
. (:issue:`10239`) - Bug in :func:`eval` with
engine="numexpr"
returning unexpected result for float division. (:issue:`59736`) - Bug in :func:`to_numeric` raising
TypeError
whenarg
is a :class:`Timedelta` or :class:`Timestamp` scalar. (:issue:`59944`) - Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
- Bug in :meth:`DataFrame.apply` where passing
engine="numba"
ignoredargs
passed to the applied function (:issue:`58712`) - Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which caused an exception when using NumPy attributes via
@
notation, e.g.,df.eval("@np.floor(a)")
. (:issue:`58041`) - Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which did not allow to use
tan
function. (:issue:`55091`) - Bug in :meth:`DataFrame.query` where using duplicate column names led to a
TypeError
. (:issue:`59950`) - Bug in :meth:`DataFrame.query` which raised an exception or produced incorrect results when expressions contained backtick-quoted column names containing the hash character
#
, backticks, or characters that fall outside the ASCII range (U+0001..U+007F). (:issue:`59285`) (:issue:`49633`) - Bug in :meth:`DataFrame.shift` where passing a
freq
on a DataFrame with no columns did not shift the index correctly. (:issue:`60102`) - Bug in :meth:`DataFrame.sort_index` when passing
axis="columns"
andignore_index=True
andascending=False
not returning a :class:`RangeIndex` columns (:issue:`57293`) - Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)
- Bug in :meth:`DataFrame.where` where using a non-bool type array in the function would return a
ValueError
instead of aTypeError
(:issue:`56330`) - Bug in :meth:`Index.sort_values` when passing a key function that turns values into tuples, e.g.
key=natsort.natsort_key
, would raiseTypeError
(:issue:`56081`) - Bug in :meth:`MultiIndex.fillna` error message was referring to
isna
instead offillna
(:issue:`60974`) - Bug in :meth:`Series.diff` allowing non-integer values for the
periods
argument. (:issue:`56607`) - Bug in :meth:`Series.dt` methods in :class:`ArrowDtype` that were returning incorrect values. (:issue:`57355`)
- Bug in :meth:`Series.isin` raising
TypeError
when series is large (>10**6) andvalues
contains NA (:issue:`60678`) - Bug in :meth:`Series.mode` where an exception was raised when taking the mode with nullable types with no null values in the series. (:issue:`58926`)
- Bug in :meth:`Series.rank` that doesn't preserve missing values for nullable integers when
na_option='keep'
. (:issue:`56976`) - Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when
regex=True
and missing values are present. (:issue:`56599`) - Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` throwing
ValueError
whenregex=True
and all NA values. (:issue:`60688`) - Bug in :meth:`Series.to_string` when series contains complex floats with exponents (:issue:`60405`)
- Bug in :meth:`read_csv` where chained fsspec TAR file and
compression="infer"
fails withtarfile.ReadError
(:issue:`60028`) - Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
- Bug in
Series.list
methods not preserving the original :class:`Index`. (:issue:`58425`) - Bug in
Series.list
methods not preserving the original name. (:issue:`60522`) - Bug in printing a :class:`DataFrame` with a :class:`DataFrame` stored in :attr:`DataFrame.attrs` raised a
ValueError
(:issue:`60455`) - Bug in printing a :class:`Series` with a :class:`DataFrame` stored in :attr:`Series.attrs` raised a
ValueError
(:issue:`60568`) - Fixed regression in :meth:`DataFrame.from_records` not initializing subclasses properly (:issue:`57008`)