orphan: |
---|
Warning
The 0.24.x series of releases will be the last to support Python 2. Future feature releases will support Python 3 only. See :ref:`install.dropping-27` for more.
{{ header }}
These are the changes in pandas 0.24.1. See :ref:`release` for a full changelog including other versions of pandas.
Changing the sort
parameter for :meth:`Index.union`
The default sort
value for :meth:`Index.union` has changed from True
to None
(:issue:`24959`).
The default behavior remains the same: The result is sorted, unless
self
andother
are identicalself
orother
is emptyself
orother
contain values that can not be compared (aRuntimeWarning
is raised).
This allows sort=True
to now mean "always sort". A TypeError
is raised if the values cannot be compared.
Behavior in 0.24.0
.. ipython:: python
In [1]: idx = pd.Index(['b', 'a'])
In [2]: idx.union(idx) # sort=True was the default.
Out[2]: Index(['b', 'a'], dtype='object')
In [3]: idx.union(idx, sort=True) # result is still not sorted.
Out[32]: Index(['b', 'a'], dtype='object')
New Behavior
.. ipython:: python
idx = pd.Index(['b', 'a'])
idx.union(idx) # sort=None is the default. Don't sort identical operands.
idx.union(idx, sort=True)
The same change applies to :meth:`Index.difference` and :meth:`Index.symmetric_difference`, which
would previously not sort the result when sort=True
but the values could not be compared.
Changed the behavior of :meth:`Index.intersection` with sort=True
When sort=True
is provided to :meth:`Index.intersection`, the values are always sorted. In 0.24.0,
the values would not be sorted when self
and other
were identical. Pass sort=False
to not
sort the values. This matches the behavior of pandas 0.23.4 and earlier.
Behavior in 0.23.4
.. ipython:: python
In [2]: idx = pd.Index(['b', 'a'])
In [3]: idx.intersection(idx) # sort was not a keyword.
Out[3]: Index(['b', 'a'], dtype='object')
Behavior in 0.24.0
.. ipython:: python
In [5]: idx.intersection(idx) # sort=True by default. Don't sort identical.
Out[5]: Index(['b', 'a'], dtype='object')
In [6]: idx.intersection(idx, sort=True)
Out[6]: Index(['b', 'a'], dtype='object')
New Behavior
.. ipython:: python
idx.intersection(idx) # sort=False by default
idx.intersection(idx, sort=True)
- Bug in :meth:`DataFrame.itertuples` with
records
orient raising anAttributeError
when theDataFrame
contained more than 255 columns (:issue:`24939`) - Bug in :meth:`DataFrame.itertuples` orient converting integer column names to strings prepended with an underscore (:issue:`24940`)
- Fixed regression in :class:`Index.intersection` incorrectly sorting the values by default (:issue:`24959`).
- Fixed regression in :func:`merge` when merging an empty
DataFrame
with multiple timezone-aware columns on one of the timezone-aware columns (:issue:`25014`).
Conversion
Indexing
I/O
Categorical
Timezones
Timedelta
- Bug in :func:`to_timedelta` with box=False incorrectly returning a datetime64
object instead of a timedelta64
object (:issue:`24961`)
-
-
-
Reshaping
- Bug in :meth:`DataFrame.groupby` with :class:`Grouper` when there is a time change (DST) and grouping frequency is
'1d'
(:issue:`24972`)
Visualization
- Fixed the warning for implicitly registered matplotlib converters not showing. See :ref:`whatsnew_0211.converters` for more (:issue:`24963`).
Other
.. contributors:: v0.24.0..v0.24.1