Skip to content

API: change Index set ops sort=True -> sort=None #25063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update whatsnew
  • Loading branch information
TomAugspurger committed Feb 1, 2019
commit 41c24f03b43b162ec4258187ff7196b2534b22ab
14 changes: 10 additions & 4 deletions doc/source/whatsnew/v0.24.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,20 @@ The default *behavior*, however, remains the same: the result is sorted, unless
2. ``self`` or ``other`` is empty
3. ``self`` or ``other`` contain values that can not be compared (a ``RuntimeWarning`` is raised).

This change will allow to preserve ``sort=True`` to mean "always sort" in a future release.
This change will allow ``sort=True`` to mean "always sort" in a future release.

The same change applies to :meth:`Index.difference` and :meth:`Index.symmetric_difference`, which
would do not sort the result when the values could not be compared.

For :meth:`Index.intersection` the option of ``sort=True`` is also renamed
to ``sort=None`` (but for :meth:`Index.intersection` it is not the default), as
the result is not sorted when ``self`` and ``other`` were identical.
The `sort` option for :meth:`Index.intersection` has changed in three ways.

1. The default has changed from ``True`` to ``False``, to restore the
pandas 0.23.4 and earlier behavior of not sorting by default.
2. The behavior of ``sort=True`` can now be obtained with ``sort=None``.
This will sort the result only if the values in ``self`` and ``other``
are not identical.
Copy link
Contributor

@h-vetinari h-vetinari Feb 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"...are not identical or either is empty."?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For intersection that'd be empty, which we can claim is sorted :)

3. The value ``sort=True`` is no longer allowed. A future version of pandas
will properly support ``sort=True`` meaning "always sort".

.. _whatsnew_0241.regressions:

Expand Down