Warning
Starting with the 1.x series of releases, pandas only supports Python 3.6.1 and higher.
Starting with Pandas 1.0.0, pandas will adopt a version of SemVer.
Historically, pandas has used a "rolling" deprecation policy, with occasional outright breaking API changes. Where possible, we would deprecate the behavior we'd like to change, giving an option to adopt the new behavior (via a keyword or an alternative method), and issuing a warning for users of the old behavior. Sometimes, a deprecation was not possible, and we would make an outright API breaking change.
We'll continue to introduce deprecations in major and minor releases (e.g. 1.0.0, 1.1.0, ...). Those deprecations will be enforced in the next major release.
Note that behavior changes and API breaking changes are not identical. API breaking changes will only be released in major versions. If we consider a behavior to be a bug, and fixing that bug induces a behavior change, we'll release that change in a minor release. This is a sometimes difficult judgment call that we'll do our best on.
This doesn't mean that pandas' pace of development will slow down. In the 2019 Pandas User Survey, about 95% of the respondents said they considered pandas "stable enough". This indicates there's an appetite for new features, even if it comes at the cost of break API. The difference is that now API breaking changes will be accompanied with a bump in the major version number (e.g. pandas 1.5.1 -> 2.0.0).
See :ref:`policies.version` for more.
{{ header }}
These are the changes in pandas 1.0.0. See :ref:`release` for a full changelog including other versions of pandas.
We've added :class:`StringDtype`, an extension type dedicated to string data. Previously, strings were typically stored in object-dtype NumPy arrays.
Warning
StringDtype
is currently considered experimental. The implementation
and parts of the API may change without warning.
The 'string'
extension type solves several issues with object-dtype NumPy arrays:
- You can accidentally store a mixture of strings and non-strings in an
object
dtype array. AStringArray
can only store strings. object
dtype breaks dtype-specific operations like :meth:`DataFrame.select_dtypes`. There isn't a clear way to select just text while excluding non-text, but still object-dtype columns.- When reading code, the contents of an
object
dtype array is less clear thanstring
.
.. ipython:: python pd.Series(['abc', None, 'def'], dtype=pd.StringDtype())
You can use the alias "string"
as well.
.. ipython:: python s = pd.Series(['abc', None, 'def'], dtype="string") s
The usual string accessor methods work. Where appropriate, the return type of the Series or columns of a DataFrame will also have string dtype.
.. ipython:: python s.str.upper() s.str.split('b', expand=True).dtypes
String accessor methods returning integers will return a value with :class:`Int64Dtype`
.. ipython:: python s.str.count("a")
We recommend explicitly using the string
data type when working with strings.
See :ref:`text.types` for more.
A new pd.NA
value (singleton) is introduced to represent scalar missing
values. Up to now, np.nan
is used for this for float data, np.nan
or
None
for object-dtype data and pd.NaT
for datetime-like data. The
goal of pd.NA
is provide a "missing" indicator that can be used
consistently accross data types. For now, the nullable integer and boolean
data types and the new string data type make use of pd.NA
(:issue:`28095`).
Warning
Experimental: the behaviour of pd.NA
can still change without warning.
For example, creating a Series using the nullable integer dtype:
.. ipython:: python s = pd.Series([1, 2, None], dtype="Int64") s s[2]
Compared to np.nan
, pd.NA
behaves differently in certain operations.
In addition to arithmetic operations, pd.NA
also propagates as "missing"
or "unknown" in comparison operations:
.. ipython:: python np.nan > 1 pd.NA > 1
For logical operations, pd.NA
follows the rules of the
three-valued logic (or
Kleene logic). For example:
.. ipython:: python pd.NA | True
For more, see :ref:`NA section <missing_data.NA>` in the user guide on missing data.
We've added :class:`BooleanDtype` / :class:`~arrays.BooleanArray`, an extension
type dedicated to boolean data that can hold missing values. With the default
'bool
data type based on a numpy bool array, the column can only hold
True or False values and not missing values. This new :class:`BooleanDtype`
can store missing values as well by keeping track of this in a separate mask.
(:issue:`29555`)
.. ipython:: python pd.Series([True, False, None], dtype=pd.BooleanDtype())
You can use the alias "boolean"
as well.
.. ipython:: python s = pd.Series([True, False, None], dtype="boolean") s
We've added a :func:`pandas.api.indexers.BaseIndexer` class that allows users to define how
window bounds are created during rolling
operations. Users can define their own get_window_bounds
method on a :func:`pandas.api.indexers.BaseIndexer` subclass that will generate the start and end
indices used for each window during the rolling aggregation. For more details and example usage, see
the :ref:`custom window rolling documentation <stats.custom_rolling_window>`
- :meth:`DataFrame.to_string` added the
max_colwidth
parameter to control when wide columns are truncated (:issue:`9784`) - :meth:`MultiIndex.from_product` infers level names from inputs if not explicitly provided (:issue:`27292`)
- :meth:`DataFrame.to_latex` now accepts
caption
andlabel
arguments (:issue:`25436`) - The :ref:`integer dtype <integer_na>` with support for missing values and the
new :ref:`string dtype <text.types>` can now be converted to
pyarrow
(>= 0.15.0), which means that it is supported in writing to the Parquet file format when using thepyarrow
engine. It is currently not yet supported when converting back to pandas, so it will become an integer or float (depending on the presence of missing data) or object dtype column. (:issue:`28368`) - :meth:`DataFrame.to_json` now accepts an
indent
integer argument to enable pretty printing of JSON output (:issue:`12004`) - :meth:`read_stata` can read Stata 119 dta files. (:issue:`28250`)
- Implemented :meth:`pandas.core.window.Window.var` and :meth:`pandas.core.window.Window.std` functions (:issue:`26597`)
- Added
encoding
argument to :meth:`DataFrame.to_string` for non-ascii text (:issue:`28766`) - Added
encoding
argument to :func:`DataFrame.to_html` for non-ascii text (:issue:`28663`) - :meth:`Styler.background_gradient` now accepts
vmin
andvmax
arguments (:issue:`12145`) - :meth:`Styler.format` added the
na_rep
parameter to help format the missing values (:issue:`21527`, :issue:`28358`) - Roundtripping DataFrames with nullable integer or string data types to parquet (:meth:`~DataFrame.to_parquet` / :func:`read_parquet`) using the 'pyarrow' engine now preserve those data types with pyarrow >= 1.0.0 (:issue:`20612`).
Pandas has added a pyproject.toml file and will no longer include
cythonized files in the source distribution uploaded to PyPI (:issue:`28341`, :issue:`20775`). If you're installing
a built distribution (wheel) or via conda, this shouldn't have any effect on you. If you're building pandas from
source, you should no longer need to install Cython into your build environment before calling pip install pandas
.
As part of a larger refactor to :class:`MultiIndex` the level names are now stored separately from the levels (:issue:`27242`). We recommend using :attr:`MultiIndex.names` to access the names, and :meth:`Index.set_names` to update the names.
For backwards compatibility, you can still access the names via the levels.
.. ipython:: python mi = pd.MultiIndex.from_product([[1, 2], ['a', 'b']], names=['x', 'y']) mi.levels[0].name
However, it is no longer possible to update the names of the MultiIndex
via the name of the level. The following will silently fail to update the
name of the MultiIndex
.. ipython:: python mi.levels[0].name = "new name" mi.names
To update, use MultiIndex.set_names
, which returns a new MultiIndex
.
.. ipython:: python mi2 = mi.set_names("new name", level=0) mi2.names
New repr for :class:`pandas.core.arrays.IntervalArray`
- :class:`pandas.core.arrays.IntervalArray` adopts a new
__repr__
in accordance with other array classes (:issue:`25022`)
pandas 0.25.x
In [1]: pd.arrays.IntervalArray.from_tuples([(0, 1), (2, 3)])
Out[2]:
IntervalArray([(0, 1], (2, 3]],
closed='right',
dtype='interval[int64]')
pandas 1.0.0
.. ipython:: python pd.arrays.IntervalArray.from_tuples([(0, 1), (2, 3)])
All :class:`SeriesGroupBy` aggregation methods now respect the observed
keyword
The following methods now also correctly output values for unobserved categories when called through groupby(..., observed=False)
(:issue:`17605`)
- :meth:`SeriesGroupBy.count`
- :meth:`SeriesGroupBy.size`
- :meth:`SeriesGroupBy.nunique`
- :meth:`SeriesGroupBy.nth`
.. ipython:: python df = pd.DataFrame({ "cat_1": pd.Categorical(list("AABB"), categories=list("ABC")), "cat_2": pd.Categorical(list("AB") * 2, categories=list("ABC")), "value": [0.1] * 4, }) df
pandas 0.25.x
In [2]: df.groupby(["cat_1", "cat_2"], observed=False)["value"].count()
Out[2]:
cat_1 cat_2
A A 1
B 1
B A 1
B 1
Name: value, dtype: int64
pandas 1.0.0
.. ipython:: python df.groupby(["cat_1", "cat_2"], observed=False)["value"].count()
:meth:`pandas.array` inference changes
:meth:`pandas.array` now infers pandas' new extension types in several cases (:issue:`29791`):
- String data (including missing values) now returns a :class:`arrays.StringArray`.
- Integer data (including missing values) now returns a :class:`arrays.IntegerArray`.
- Boolean data (including missing values) now returns the new :class:`arrays.BooleanArray`
pandas 0.25.x
>>> pd.array(["a", None])
<PandasArray>
['a', None]
Length: 2, dtype: object
>>> pd.array([1, None])
<PandasArray>
[1, None]
Length: 2, dtype: object
pandas 1.0.0
.. ipython:: python pd.array(["a", None]) pd.array([1, None])
As a reminder, you can specify the dtype
to disable all inference.
By default :meth:`Categorical.min` now returns the minimum instead of np.nan
When :class:`Categorical` contains np.nan
,
:meth:`Categorical.min` no longer return np.nan
by default (skipna=True) (:issue:`25303`)
pandas 0.25.x
In [1]: pd.Categorical([1, 2, np.nan], ordered=True).min()
Out[1]: nan
pandas 1.0.0
.. ipython:: python pd.Categorical([1, 2, np.nan], ordered=True).min()
Default dtype of empty :class:`pandas.Series`
Initialising an empty :class:`pandas.Series` without specifying a dtype will raise a DeprecationWarning now
(:issue:`17261`). The default dtype will change from float64
to object
in future releases so that it is
consistent with the behaviour of :class:`DataFrame` and :class:`Index`.
pandas 1.0.0
In [1]: pd.Series()
Out[2]:
DeprecationWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.
Series([], dtype: float64)
Some minimum supported versions of dependencies were updated (:issue:`29766`, :issue:`29723`). If installed, we now require:
Package | Minimum Version | Required | Changed |
---|---|---|---|
numpy | 1.13.3 | X | |
pytz | 2015.4 | X | |
python-dateutil | 2.6.1 | X | |
bottleneck | 1.2.1 | ||
numexpr | 2.6.2 | ||
pytest (dev) | 4.0.2 |
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 |
---|---|---|
beautifulsoup4 | 4.6.0 | |
fastparquet | 0.3.2 | X |
gcsfs | 0.2.2 | |
lxml | 3.8.0 | |
matplotlib | 2.2.2 | |
openpyxl | 2.4.8 | |
pyarrow | 0.12.0 | X |
pymysql | 0.7.1 | |
pytables | 3.4.2 | |
scipy | 0.19.0 | |
sqlalchemy | 1.1.4 | |
xarray | 0.8.2 | |
xlrd | 1.1.0 | |
xlsxwriter | 0.9.8 | |
xlwt | 1.2.0 |
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
- Bumpded the minimum supported version of
s3fs
from 0.0.8 to 0.3.0 (:issue:`28616`) - :class:`pandas.core.groupby.GroupBy.transform` now raises on invalid operation names (:issue:`27489`)
- :meth:`pandas.api.types.infer_dtype` will now return "integer-na" for integer and
np.nan
mix (:issue:`27283`) - :meth:`MultiIndex.from_arrays` will no longer infer names from arrays if
names=None
is explicitly provided (:issue:`27292`) - In order to improve tab-completion, Pandas does not include most deprecated attributes when introspecting a pandas object using
dir
(e.g.dir(df)
). To see which attributes are excluded, see an object's_deprecations
attribute, for examplepd.DataFrame._deprecations
(:issue:`28805`). - The returned dtype of ::func:`pd.unique` now matches the input dtype. (:issue:`27874`)
- Changed the default configuration value for
options.matplotlib.register_converters
fromTrue
to"auto"
(:issue:`18720`). Now, pandas custom formatters will only be applied to plots created by pandas, through :meth:`~DataFrame.plot`. Previously, pandas' formatters would be applied to all plots created after a :meth:`~DataFrame.plot`. See :ref:`units registration <whatsnew_1000.matplotlib_units>` for more. - :meth:`Series.dropna` has dropped its
**kwargs
argument in favor of a singlehow
parameter. Supplying anything else thanhow
to**kwargs
raised aTypeError
previously (:issue:`29388`) - When testing pandas, the new minimum required version of pytest is 5.0.1 (:issue:`29664`)
- Added new section on :ref:`scale` (:issue:`28315`).
- Added sub-section Query MultiIndex in IO tools user guide (:issue:`28791`)
Index.set_value
has been deprecated. For a given indexidx
, arrayarr
, value inidx
ofidx_val
and a new value ofval
,idx.set_value(arr, idx_val, val)
is equivalent toarr[idx.get_loc(idx_val)] = val
, which should be used instead (:issue:`28621`).- :func:`is_extension_type` is deprecated, :func:`is_extension_array_dtype` should be used instead (:issue:`29457`)
- :func:`eval` keyword argument "truediv" is deprecated and will be removed in a future version (:issue:`29812`)
- :meth:`Categorical.take_nd` is deprecated, use :meth:`Categorical.take` instead (:issue:`27745`)
- The parameter
numeric_only
of :meth:`Categorical.min` and :meth:`Categorical.max` is deprecated and replaced withskipna
(:issue:`25303`)
SparseSeries
, SparseDataFrame
and the DataFrame.to_sparse
method
have been removed (:issue:`28425`). We recommend using a Series
or
DataFrame
with sparse values instead. See :ref:`sparse.migration` for help
with migrating existing code.
Matplotlib unit registration
Previously, pandas would register converters with matplotlib as a side effect of importing pandas (:issue:`18720`). This changed the output of plots made via matplotlib plots after pandas was imported, even if you were using matplotlib directly rather than :meth:`~DataFrame.plot`.
To use pandas formatters with a matplotlib plot, specify
>>> import pandas as pd
>>> pd.options.plotting.matplotlib.register_converters = True
Note that plots created by :meth:`DataFrame.plot` and :meth:`Series.plot` do register the converters
automatically. The only behavior change is when plotting a date-like object via matplotlib.pyplot.plot
or matplotlib.Axes.plot
. See :ref:`plotting.formatters` for more.
Other removals
- Removed the previously deprecated :func:`pandas.plotting._matplotlib.tsplot`, use :meth:`Series.plot` instead (:issue:`19980`)
- :func:`pandas.tseries.converter.register` has been moved to :func:`pandas.plotting.register_matplotlib_converters` (:issue:`18307`)
- :meth:`Series.plot` no longer accepts positional arguments, pass keyword arguments instead (:issue:`30003`)
- :meth:`DataFrame.hist` and :meth:`Series.hist` no longer allows
figsize="default"
, specify figure size by passinig a tuple instead (:issue:`30003`) - Floordiv of integer-dtyped array by :class:`Timedelta` now raises
TypeError
(:issue:`21036`) - :func:`pandas.api.types.infer_dtype` argument
skipna
defaults toTrue
instead ofFalse
(:issue:`24050`) - Removed the previously deprecated :meth:`Index.summary` (:issue:`18217`)
- Removed the previously deprecated "fastpath" keyword from the :class:`Index` constructor (:issue:`23110`)
- Removed the previously deprecated :meth:`Series.get_value`, :meth:`Series.set_value`, :meth:`DataFrame.get_value`, :meth:`DataFrame.set_value` (:issue:`17739`)
- Removed the previously deprecated :meth:`Series.compound` and :meth:`DataFrame.compound` (:issue:`26405`)
- Changed the the default value of inplace in :meth:`DataFrame.set_index` and :meth:`Series.set_axis`. It now defaults to
False
(:issue:`27600`) - Removed the previously deprecated :attr:`Series.cat.categorical`, :attr:`Series.cat.index`, :attr:`Series.cat.name` (:issue:`24751`)
- :func:`to_datetime` no longer accepts "box" argument, always returns :class:`DatetimeIndex` or :class:`Index`, :class:`Series`, or :class:`DataFrame` (:issue:`24486`)
- Removed the previously deprecated
time_rule
keyword from (non-public) :func:`offsets.generate_range`, which has been moved to :func:`core.arrays._ranges.generate_range` (:issue:`24157`) - :meth:`DataFrame.loc` or :meth:`Series.loc` with listlike indexers and missing labels will no longer reindex (:issue:`17295`)
- :meth:`DataFrame.to_excel` and :meth:`Series.to_excel` with non-existent columns will no longer reindex (:issue:`17295`)
- :func:`concat` parameter "join_axes" has been removed, use
reindex_like
on the result instead (:issue:`22318`) - Removed the previously deprecated "by" keyword from :meth:`DataFrame.sort_index`, use :meth:`DataFrame.sort_values` instead (:issue:`10726`)
- Removed support for nested renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`18529`)
- Passing
datetime64
data to :class:`TimedeltaIndex` ortimedelta64
data toDatetimeIndex
now raisesTypeError
(:issue:`23539`, :issue:`23937`) - A tuple passed to :meth:`DataFrame.groupby` is now exclusively treated as a single key (:issue:`18314`)
- Removed :meth:`Series.from_array` (:issue:`18258`)
- Removed :meth:`DataFrame.from_items` (:issue:`18458`)
- Removed :meth:`DataFrame.as_matrix`, :meth:`Series.as_matrix` (:issue:`18458`)
- Removed :meth:`Series.asobject` (:issue:`18477`)
- Removed :meth:`DataFrame.as_blocks`, :meth:`Series.as_blocks`, DataFrame.blocks, :meth:`Series.blocks` (:issue:`17656`)
- :meth:`pandas.Series.str.cat` now defaults to aligning
others
, usingjoin='left'
(:issue:`27611`) - :meth:`pandas.Series.str.cat` does not accept list-likes within list-likes anymore (:issue:`27611`)
- :meth:`Series.where` with
Categorical
dtype (or :meth:`DataFrame.where` withCategorical
column) no longer allows setting new categories (:issue:`24114`) - :class:`DatetimeIndex`, :class:`TimedeltaIndex`, and :class:`PeriodIndex` constructors no longer allow
start
,end
, andperiods
keywords, use :func:`date_range`, :func:`timedelta_range`, and :func:`period_range` instead (:issue:`23919`) - :class:`DatetimeIndex` and :class:`TimedeltaIndex` constructors no longer have a
verify_integrity
keyword argument (:issue:`23919`) - :func:`core.internals.blocks.make_block` no longer accepts the "fastpath" keyword(:issue:`19265`)
- :meth:`Block.make_block_same_class` no longer accepts the "dtype" keyword(:issue:`19434`)
- Removed the previously deprecated :meth:`ExtensionArray._formatting_values`. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`)
- Removed the previously deprecated :meth:`MultiIndex.to_hierarchical` (:issue:`21613`)
- Removed the previously deprecated :attr:`MultiIndex.labels`, use :attr:`MultiIndex.codes` instead (:issue:`23752`)
- Removed the previously deprecated "labels" keyword from the :class:`MultiIndex` constructor, use "codes" instead (:issue:`23752`)
- Removed the previously deprecated :meth:`MultiIndex.set_labels`, use :meth:`MultiIndex.set_codes` instead (:issue:`23752`)
- Removed the previously deprecated "labels" keyword from :meth:`MultiIndex.set_codes`, :meth:`MultiIndex.copy`, :meth:`MultiIndex.drop`, use "codes" instead (:issue:`23752`)
- Removed support for legacy HDF5 formats (:issue:`29787`)
- Passing a dtype alias (e.g. 'datetime64[ns, UTC]') to :class:`DatetimeTZDtype` is no longer allowed, use :meth:`DatetimeTZDtype.construct_from_string` instead (:issue:`23990`)
- :func:`read_excel` removed support for "skip_footer" argument, use "skipfooter" instead (:issue:`18836`)
- :func:`read_excel` no longer allows an integer value for the parameter
usecols
, instead pass a list of integers from 0 tousecols
inclusive (:issue:`23635`) - :meth:`DataFrame.to_records` no longer supports the argument "convert_datetime64" (:issue:`18902`)
- Removed the previously deprecated
IntervalIndex.from_intervals
in favor of the :class:`IntervalIndex` constructor (:issue:`19263`) - Changed the default value for the "keep_tz" argument in :meth:`DatetimeIndex.to_series` to
True
(:issue:`23739`) - Removed the previously deprecated :func:`api.types.is_period` and :func:`api.types.is_datetimetz` (:issue:`23917`)
- Ability to read pickles containing :class:`Categorical` instances created with pre-0.16 version of pandas has been removed (:issue:`27538`)
- Removed previously deprecated :func:`pandas.tseries.plotting.tsplot` (:issue:`18627`)
- Removed the previously deprecated
reduce
andbroadcast
arguments from :meth:`DataFrame.apply` (:issue:`18577`) - Removed the previously deprecated
assert_raises_regex
function inpandas.util.testing
(:issue:`29174`) - Removed the previously deprecated
FrozenNDArray
class inpandas.core.indexes.frozen
(:issue:`29335`) - Removed previously deprecated "nthreads" argument from :func:`read_feather`, use "use_threads" instead (:issue:`23053`)
- Removed :meth:`Index.is_lexsorted_for_tuple` (:issue:`29305`)
- Removed support for nexted renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`29608`)
- Removed the previously deprecated :meth:`Series.valid`; use :meth:`Series.dropna` instead (:issue:`18800`)
- Removed the previously properties :attr:`DataFrame.is_copy`, :attr:`Series.is_copy` (:issue:`18812`)
- Removed the previously deprecated :meth:`DataFrame.get_ftype_counts`, :meth:`Series.get_ftype_counts` (:issue:`18243`)
- Removed the previously deprecated :meth:`DataFrame.ftypes`, :meth:`Series.ftypes`, :meth:`Series.ftype` (:issue:`26744`)
- Removed the previously deprecated :meth:`Index.get_duplicates`, use
idx[idx.duplicated()].unique()
instead (:issue:`20239`) - Removed the previously deprecated :meth:`Series.clip_upper`, :meth:`Series.clip_lower`, :meth:`DataFrame.clip_upper`, :meth:`DataFrame.clip_lower` (:issue:`24203`)
- Removed the ability to alter :attr:`DatetimeIndex.freq`, :attr:`TimedeltaIndex.freq`, or :attr:`PeriodIndex.freq` (:issue:`20772`)
- Removed the previously deprecated :attr:`DatetimeIndex.offset` (:issue:`20730`)
- Removed the previously deprecated :meth:`DatetimeIndex.asobject`, :meth:`TimedeltaIndex.asobject`, :meth:`PeriodIndex.asobject`, use
astype(object)
instead (:issue:`29801`) - Removed previously deprecated "order" argument from :func:`factorize` (:issue:`19751`)
- :func:`read_stata` and :meth:`DataFrame.to_stata` no longer supports the "encoding" argument (:issue:`21400`)
- In :func:`concat` the default value for
sort
has been changed fromNone
toFalse
(:issue:`20613`) - Removed previously deprecated "raise_conflict" argument from :meth:`DataFrame.update`, use "errors" instead (:issue:`23585`)
- Removed previously deprecated keyword "n" from :meth:`DatetimeIndex.shift`, :meth:`TimedeltaIndex.shift`, :meth:`PeriodIndex.shift`, use "periods" instead (:issue:`22458`)
- Passing an integer to :meth:`Series.fillna` or :meth:`DataFrame.fillna` with
timedelta64[ns]
dtype now raisesTypeError
(:issue:`24694`) - Passing multiple axes to :meth:`DataFrame.dropna` is no longer supported (:issue:`20995`)
- Removed previously deprecated :meth:`Series.nonzero`, use to_numpy().nonzero() instead (:issue:`24048`)
- Passing floating dtype
codes
to :meth:`Categorical.from_codes` is no longer supported, passcodes.astype(np.int64)
instead (:issue:`21775`) - :meth:`Series.str.partition` and :meth:`Series.str.rpartition` no longer accept "pat" keyword, use "sep" instead (:issue:`23767`)
- Removed the previously deprecated :meth:`Series.put` (:issue:`27106`)
- Removed the previously deprecated :attr:`Series.real`, :attr:`Series.imag` (:issue:`27106`)
- Removed the previously deprecated :meth:`Series.to_dense`, :meth:`DataFrame.to_dense` (:issue:`26684`)
- Removed the previously deprecated :meth:`Index.dtype_str`, use
str(index.dtype)
instead (:issue:`27106`) - :meth:`Categorical.ravel` returns a :class:`Categorical` instead of a
ndarray
(:issue:`27199`) - The 'outer' method on Numpy ufuncs, e.g.
np.subtract.outer
operating on :class:`Series` objects is no longer supported, and will raiseNotImplementedError
(:issue:`27198`) - Removed previously deprecated :meth:`Series.get_dtype_counts` and :meth:`DataFrame.get_dtype_counts` (:issue:`27145`)
- Changed the default
fill_value
in :meth:`Categorical.take` fromTrue
toFalse
(:issue:`20841`) - Changed the default value for the raw argument in :func:`Series.rolling().apply() <pandas.core.window.Rolling.apply>`, :func:`DataFrame.rolling().apply() <pandas.core.window.Rolling.apply>`,
- :func:`Series.expanding().apply() <pandas.core.window.Expanding.apply>`, and :func:`DataFrame.expanding().apply() <pandas.core.window.Expanding.apply>` to
False
(:issue:`20584`) - Passing a tz-aware
datetime.datetime
or :class:`Timestamp` into the :class:`Timestamp` constructor with thetz
argument now raises aValueError
(:issue:`23621`) - Removed the previously deprecated :attr:`Series.base`, :attr:`Index.base`, :attr:`Categorical.base`, :attr:`Series.flags`, :attr:`Index.flags`, :attr:`PeriodArray.flags`, :attr:`Series.strides`, :attr:`Index.strides`, :attr:`Series.itemsize`, :attr:`Index.itemsize`, :attr:`Series.data`, :attr:`Index.data` (:issue:`20721`)
- Changed :meth:`Timedelta.resolution` to match the behavior of the standard library
datetime.timedelta.resolution
, for the old behavior, use :meth:`Timedelta.resolution_string` (:issue:`26839`) - Removed previously deprecated :attr:`Timestamp.weekday_name`, :attr:`DatetimeIndex.weekday_name`, and :attr:`Series.dt.weekday_name` (:issue:`18164`)
- Removed previously deprecated
errors
argument in :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` (:issue:`22644`) - :meth:`Series.set_axis` and :meth:`DataFrame.set_axis` now require "labels" as the first argument and "axis" as an optional named parameter (:issue:`30089`)
- Performance improvement in indexing with a non-unique :class:`IntervalIndex` (:issue:`27489`)
- Performance improvement in MultiIndex.is_monotonic (:issue:`27495`)
- Performance improvement in :func:`cut` when
bins
is an :class:`IntervalIndex` (:issue:`27668`) - Performance improvement in :meth:`DataFrame.corr` when
method
is"spearman"
(:issue:`28139`) - Performance improvement in :meth:`DataFrame.replace` when provided a list of values to replace (:issue:`28099`)
- Performance improvement in :meth:`DataFrame.select_dtypes` by using vectorization instead of iterating over a loop (:issue:`28317`)
- Performance improvement in :meth:`Categorical.searchsorted` and :meth:`CategoricalIndex.searchsorted` (:issue:`28795`)
- Performance improvement when comparing a :class:`Categorical` with a scalar and the scalar is not found in the categories (:issue:`29750`)
- Performance improvement when checking if values in a :class:`Categorical` are equal, equal or larger or larger than a given scalar. The improvement is not present if checking if the :class:`Categorical` is less than or less than or equal than the scalar (:issue:`29820`)
- Performance improvement in :meth:`Index.equals` and :meth:`MultiIndex.equals` (:issue:`29134`)
- Added test to assert the :func:`fillna` raises the correct
ValueError
message when the value isn't a value from categories (:issue:`13628`) - Bug in :meth:`Categorical.astype` where
NaN
values were handled incorrectly when casting to int (:issue:`28406`) - :meth:`DataFrame.reindex` with a :class:`CategoricalIndex` would fail when the targets contained duplicates, and wouldn't fail if the source contained duplicates (:issue:`28107`)
- Bug in :meth:`Categorical.astype` not allowing for casting to extension dtypes (:issue:`28668`)
- Bug where :func:`merge` was unable to join on categorical and extension dtype columns (:issue:`28668`)
- :meth:`Categorical.searchsorted` and :meth:`CategoricalIndex.searchsorted` now work on unordered categoricals also (:issue:`21667`)
- Added test to assert roundtripping to parquet with :func:`DataFrame.to_parquet` or :func:`read_parquet` will preserve Categorical dtypes for string types (:issue:`27955`)
- Changed the error message in :meth:`Categorical.remove_categories` to always show the invalid removals as a set (:issue:`28669`)
- Using date accessors on a categorical dtyped :class:`Series` of datetimes was not returning an object of the same type as if one used the :meth:`.str.` / :meth:`.dt.` on a :class:`Series` of that type. E.g. when accessing :meth:`Series.dt.tz_localize` on a :class:`Categorical` with duplicate entries, the accessor was skipping duplicates (:issue:`27952`)
- Bug in :meth:`DataFrame.replace` and :meth:`Series.replace` that would give incorrect results on categorical data (:issue:`26988`)
- Bug in :meth:`Series.__setitem__` incorrectly casting
np.timedelta64("NaT")
tonp.datetime64("NaT")
when inserting into a :class:`Series` with datetime64 dtype (:issue:`27311`) - Bug in :meth:`Series.dt` property lookups when the underlying data is read-only (:issue:`27529`)
- Bug in
HDFStore.__getitem__
incorrectly reading tz attribute created in Python 2 (:issue:`26443`) - Bug in :func:`to_datetime` where passing arrays of malformed
str
with errors="coerce" could incorrectly lead to raisingValueError
(:issue:`28299`) - Bug in :meth:`pandas.core.groupby.SeriesGroupBy.nunique` where
NaT
values were interfering with the count of unique values (:issue:`27951`) - Bug in :class:`Timestamp` subtraction when subtracting a :class:`Timestamp` from a
np.datetime64
object incorrectly raisingTypeError
(:issue:`28286`) - Addition and subtraction of integer or integer-dtype arrays with :class:`Timestamp` will now raise
NullFrequencyError
instead ofValueError
(:issue:`28268`) - Bug in :class:`Series` and :class:`DataFrame` with integer dtype failing to raise
TypeError
when adding or subtracting anp.datetime64
object (:issue:`28080`) - Bug in :class:`Week` with
weekday
incorrectly raisingAttributeError
instead ofTypeError
when adding or subtracting an invalid type (:issue:`28530`) - Bug in :class:`DataFrame` arithmetic operations when operating with a :class:`Series` with dtype 'timedelta64[ns]' (:issue:`28049`)
- Bug in :func:`pandas.core.groupby.generic.SeriesGroupBy.apply` raising
ValueError
when a column in the original DataFrame is a datetime and the column labels are not standard integers (:issue:`28247`) - Bug in :func:`pandas._config.localization.get_locales` where the
locales -a
encodes the locales list as windows-1252 (:issue:`23638`, :issue:`24760`, :issue:`27368`) - Bug in :meth:`Series.var` failing to raise
TypeError
when called withtimedelta64[ns]
dtype (:issue:`28289`) - Bug in :meth:`DatetimeIndex.strftime` and :meth:`Series.dt.strftime` where
NaT
was converted to the string'NaT'
instead ofnp.nan
(:issue:`29578`) - Bug in :attr:`Timestamp.resolution` being a property instead of a class attribute (:issue:`29910`)
- Bug in subtracting a :class:`TimedeltaIndex` or :class:`TimedeltaArray` from a
np.datetime64
object (:issue:`29558`)
- Bug in :meth:`DataFrame.quantile` with zero-column :class:`DataFrame` incorrectly raising (:issue:`23925`)
- :class:`DataFrame` flex inequality comparisons methods (:meth:`DataFrame.lt`, :meth:`DataFrame.le`, :meth:`DataFrame.gt`, :meth:`DataFrame.ge`) with object-dtype and
complex
entries failing to raiseTypeError
like their :class:`Series` counterparts (:issue:`28079`) - Bug in :class:`DataFrame` logical operations (&, |, ^) not matching :class:`Series` behavior by filling NA values (:issue:`28741`)
- Bug in :meth:`DataFrame.interpolate` where specifying axis by name references variable before it is assigned (:issue:`29142`)
- Bug in :meth:`Series.var` not computing the right value with a nullable integer dtype series not passing through ddof argument (:issue:`29128`)
- Improved error message when using frac > 1 and replace = False (:issue:`27451`)
- Bug in numeric indexes resulted in it being possible to instantiate an :class:`Int64Index`, :class:`UInt64Index`, or :class:`Float64Index` with an invalid dtype (e.g. datetime-like) (:issue:`29539`)
- Bug in :class:`UInt64Index` precision loss while constructing from a list with values in the
np.uint64
range (:issue:`29526`) - Bug in :class:`NumericIndex` construction that caused indexing to fail when integers in the
np.uint64
range were used (:issue:`28023`) - Bug in :class:`NumericIndex` construction that caused :class:`UInt64Index` to be casted to :class:`Float64Index` when integers in the
np.uint64
range were used to index a :class:`DataFrame` (:issue:`28279`) - Bug in :meth:`Series.interpolate` when using method=`index` with an unsorted index, would previously return incorrect results. (:issue:`21037`)
- Calling :meth:`Series.str.isalnum` (and other "ismethods") on an empty Series would return an object dtype instead of bool (:issue:`29624`)
- Bug in assignment using a reverse slicer (:issue:`26939`)
- Bug in :meth:`DataFrame.explode` would duplicate frame in the presence of duplicates in the index (:issue:`28010`)
- Bug in reindexing a :meth:`PeriodIndex` with another type of index that contained a Period (:issue:`28323`) (:issue:`28337`)
- Fix assignment of column via .loc with numpy non-ns datetime type (:issue:`27395`)
- Bug in :meth:`Float64Index.astype` where
np.inf
was not handled properly when casting to an integer dtype (:issue:`28475`) - :meth:`Index.union` could fail when the left contained duplicates (:issue:`28257`)
- :meth:`Index.get_indexer_non_unique` could fail with TypeError in some cases, such as when searching for ints in a string index (:issue:`28257`)
- Bug in :meth:`Float64Index.get_loc` incorrectly raising
TypeError
instead ofKeyError
(:issue:`29189`)
- Constructior for :class:`MultiIndex` verifies that the given
sortorder
is compatible with the actuallexsort_depth
ifverify_integrity
parameter isTrue
(the default) (:issue:`28735`)
- :meth:`read_csv` now accepts binary mode file buffers when using the Python csv engine (:issue:`23779`)
- Bug in :meth:`DataFrame.to_json` where using a Tuple as a column or index value and using
orient="columns"
ororient="index"
would produce invalid JSON (:issue:`20500`) - Improve infinity parsing. :meth:`read_csv` now interprets
Infinity
,+Infinity
,-Infinity
as floating point values (:issue:`10065`) - Bug in :meth:`DataFrame.to_csv` where values were truncated when the length of
na_rep
was shorter than the text input data. (:issue:`25099`) - Bug in :func:`DataFrame.to_string` where values were truncated using display options instead of outputting the full content (:issue:`9784`)
- Bug in :meth:`DataFrame.to_json` where a datetime column label would not be written out in ISO format with
orient="table"
(:issue:`28130`) - Bug in :func:`DataFrame.to_parquet` where writing to GCS would fail with engine='fastparquet' if the file did not already exist (:issue:`28326`)
- Bug in :func:`read_hdf` closing stores that it didn't open when Exceptions are raised (:issue:`28699`)
- Bug in :meth:`DataFrame.read_json` where using
orient="index"
would not maintain the order (:issue:`28557`) - Bug in :meth:`DataFrame.to_html` where the length of the
formatters
argument was not verified (:issue:`28469`) - Bug in :meth:`DataFrame.read_excel` with
engine='ods'
whensheet_name
argument references a non-existent sheet (:issue:`27676`) - Bug in :meth:`pandas.io.formats.style.Styler` formatting for floating values not displaying decimals correctly (:issue:`13257`)
- Bug in :meth:`DataFrame.to_html` when using
formatters=<list>
andmax_cols
together. (:issue:`25955`) - Bug in :meth:`Styler.background_gradient` not able to work with dtype
Int64
(:issue:`28869`) - Bug in :meth:`DataFrame.to_clipboard` which did not work reliably in ipython (:issue:`22707`)
- Bug in :func:`read_json` where default encoding was not set to
utf-8
(:issue:`29565`) - Bug in :class:`PythonParser` where str and bytes were being mixed when dealing with the decimal field (:issue:`29650`)
- Bug in :meth:`Series.plot` not able to plot boolean values (:issue:`23719`)
- Bug in :meth:`DataFrame.plot` not able to plot when no rows (:issue:`27758`)
- Bug in :meth:`DataFrame.plot` producing incorrect legend markers when plotting multiple series on the same axis (:issue:`18222`)
- Bug in :meth:`DataFrame.plot` when
kind='box'
and data contains datetime or timedelta data. These types are now automatically dropped (:issue:`22799`) - Bug in :meth:`DataFrame.plot.line` and :meth:`DataFrame.plot.area` produce wrong xlim in x-axis (:issue:`27686`, :issue:`25160`, :issue:`24784`)
- Bug where :meth:`DataFrame.boxplot` would not accept a color parameter like DataFrame.plot.box (:issue:`26214`)
- Bug in the
xticks
argument being ignored for :meth:`DataFrame.plot.bar` (:issue:`14119`) - :func:`set_option` now validates that the plot backend provided to
'plotting.backend'
implements the backend when the option is set, rather than when a plot is created (:issue:`28163`) - :meth:`DataFrame.plot` now allow a
backend
keyword arugment to allow changing between backends in one session (:issue:`28619`). - Bug in color validation incorrectly raising for non-color styles (:issue:`29122`).
- Bug in :meth:`DataFrame.groupby` with multiple groups where an
IndexError
would be raised if any group contained all NA values (:issue:`20519`) - Bug in :meth:`pandas.core.resample.Resampler.size` and :meth:`pandas.core.resample.Resampler.count` returning wrong dtype when used with an empty series or dataframe (:issue:`28427`)
- Bug in :meth:`DataFrame.rolling` not allowing for rolling over datetimes when
axis=1
(:issue:`28192`) - Bug in :meth:`DataFrame.rolling` not allowing rolling over multi-index levels (:issue:`15584`).
- Bug in :meth:`DataFrame.rolling` not allowing rolling on monotonic decreasing time indexes (:issue:`19248`).
- Bug in :meth:`DataFrame.groupby` not offering selection by column name when
axis=1
(:issue:`27614`) - Bug in :meth:`DataFrameGroupby.agg` not able to use lambda function with named aggregation (:issue:`27519`)
- Bug in :meth:`DataFrame.groupby` losing column name information when grouping by a categorical column (:issue:`28787`)
- Bug in :meth:`DataFrameGroupBy.rolling().quantile()` ignoring
interpolation
keyword argument (:issue:`28779`) - Bug in :meth:`DataFrame.groupby` where
any
,all
,nunique
and transform functions would incorrectly handle duplicate column labels (:issue:`21668`) - Bug in :meth:`DataFrameGroupBy.agg` with timezone-aware datetime64 column incorrectly casting results to the original dtype (:issue:`29641`)
- Bug in :meth:`DataFrame.apply` that caused incorrect output with empty :class:`DataFrame` (:issue:`28202`, :issue:`21959`)
- Bug in :meth:`DataFrame.stack` not handling non-unique indexes correctly when creating MultiIndex (:issue:`28301`)
- Bug in :meth:`pivot_table` not returning correct type
float
whenmargins=True
andaggfunc='mean'
(:issue:`24893`) - Bug :func:`merge_asof` could not use :class:`datetime.timedelta` for
tolerance
kwarg (:issue:`28098`) - Bug in :func:`merge`, did not append suffixes correctly with MultiIndex (:issue:`28518`)
- :func:`qcut` and :func:`cut` now handle boolean input (:issue:`20303`)
- Fix to ensure all int dtypes can be used in :func:`merge_asof` when using a tolerance value. Previously every non-int64 type would raise an erroneous
MergeError
(:issue:`28870`). - Better error message in :func:`get_dummies` when columns isn't a list-like value (:issue:`28383`)
- Bug :meth:`Series.pct_change` where supplying an anchored frequency would throw a ValueError (:issue:`28664`)
- Bug where :meth:`DataFrame.equals` returned True incorrectly in some cases when two DataFrames had the same columns in different orders (:issue:`28839`)
- Bug in :meth:`DataFrame.replace` that caused non-numeric replacer's dtype not respected (:issue:`26632`)
- Bug in :func:`melt` where supplying mixed strings and numeric values for
id_vars
orvalue_vars
would incorrectly raise aValueError
(:issue:`29718`) - Dtypes are now preserved when transposing a
DataFrame
where each column is the same extension dtype (:issue:`30091`) - Bug in :func:`merge_asof` merging on a tz-aware
left_index
andright_on
a tz-aware column (:issue:`29864`)
- Bug in :class:`SparseDataFrame` arithmetic operations incorrectly casting inputs to float (:issue:`28107`)
- Bug in :class:`arrays.PandasArray` when setting a scalar string (:issue:`28118`, :issue:`28150`).
- Trying to set the
display.precision
,display.max_rows
ordisplay.max_columns
using :meth:`set_option` to anything but aNone
or a positive int will raise aValueError
(:issue:`23348`) - Using :meth:`DataFrame.replace` with overlapping keys in a nested dictionary will no longer raise, now matching the behavior of a flat dictionary (:issue:`27660`)
- :meth:`DataFrame.to_csv` and :meth:`Series.to_csv` now support dicts as
compression
argument with key'method'
being the compression method and others as additional compression options when the compression method is'zip'
. (:issue:`26023`) - Bug in :meth:`Series.diff` where a boolean series would incorrectly raise a
TypeError
(:issue:`17294`) - :meth:`Series.append` will no longer raise a
TypeError
when passed a tuple ofSeries
(:issue:`28410`) - :meth:`SeriesGroupBy.value_counts` will be able to handle the case even when the :class:`Grouper` makes empty groups (:issue:`28479`)
- Fix corrupted error message when calling
pandas.libs._json.encode()
on a 0d array (:issue:`18878`) - Bug in :meth:`DataFrame.append` that raised
IndexError
when appending with empty list (:issue:`28769`) - Fix :class:`AbstractHolidayCalendar` to return correct results for years after 2030 (now goes up to 2200) (:issue:`27790`)
- Bug in :meth:`Series.count` raises if use_inf_as_na is enabled (:issue:`29478`)