Skip to content
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

DEPR: Series.argsort NA behavior #54219

Merged
merged 4 commits into from Jul 25, 2023
Merged

Conversation

jbrockmendel
Copy link
Member

@jbrockmendel jbrockmendel commented Jul 21, 2023

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Series.argsort has NA behavior different from EA.argsort/nargsort (xref #43840) that seems really useless to me. This deprecates that behavior so in the future we can just pass through to the EA.

We could expose the EA's na_position keyword, but let's wait on that until someone asks for it. AFAIK this isn't really used.

@mroeschke mroeschke added the Deprecate Functionality to remove in pandas label Jul 24, 2023
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@mroeschke
Copy link
Member

--- a/doc/source/whatsnew/v2.1.0.rst
+++ b/doc/source/whatsnew/v2.1.0.rst
@@ -295,7 +295,6 @@ Other API changes
 
 Deprecations
 ~~~~~~~~~~~~
-- Deprecated the behavior of :meth:`Series.argsort` in the presence of NA values; in a future version these will be sorted at the end instead of giving -1 (:issue:`54219`)
 - Deprecated 'broadcast_axis' keyword in :meth:`Series.align` and :meth:`DataFrame.align`, upcast before calling ``align`` with ``left = DataFrame({col: left for col in right.columns}, index=right.index)`` (:issue:`51856`)
 - Deprecated 'downcast' keyword in :meth:`Index.fillna` (:issue:`53956`)
 - Deprecated 'fill_method' and 'limit' keywords in :meth:`DataFrame.pct_change`, :meth:`Series.pct_change`, :meth:`DataFrameGroupBy.pct_change`, and :meth:`SeriesGroupBy.pct_change`, explicitly call ``ffill`` or ``bfill`` before calling ``pct_change`` instead (:issue:`53491`)
@@ -319,6 +318,7 @@ Deprecations
 - Deprecated the ``axis`` keyword in :meth:`DataFrame.ewm`, :meth:`Series.ewm`, :meth:`DataFrame.rolling`, :meth:`Series.rolling`, :meth:`DataFrame.expanding`, :meth:`Series.expanding` (:issue:`51778`)
 - Deprecated the ``axis`` keyword in :meth:`DataFrame.resample`, :meth:`Series.resample` (:issue:`51778`)
 - Deprecated the behavior of :func:`concat` with both ``len(keys) != len(objs)``, in a future version this will raise instead of truncating to the shorter of the two sequences (:issue:`43485`)
+- Deprecated the behavior of :meth:`Series.argsort` in the presence of NA values; in a future version these will be sorted at the end instead of giving -1 (:issue:`54219`)

@jbrockmendel
Copy link
Member Author

updated+green

@mroeschke mroeschke added this to the 2.1 milestone Jul 25, 2023
@mroeschke mroeschke merged commit 3ee0585 into pandas-dev:main Jul 25, 2023
36 checks passed
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the depr-argsort branch July 25, 2023 01:13
jamie-harness pushed a commit to jamie-harness/pandas1 that referenced this pull request Jul 25, 2023
* DEPR: argsort

* Catch warning in np.argsort test

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* sort hwatnsew

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
jamie-harness added a commit to jamie-harness/pandas1 that referenced this pull request Jul 25, 2023
* DEPR: argsort

* Catch warning in np.argsort test

* Update doc/source/whatsnew/v2.1.0.rst



* sort hwatnsew

---------

Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
jamie-harness pushed a commit to jamie-harness/pandas1 that referenced this pull request Jul 26, 2023
* DEPR: argsort

* Catch warning in np.argsort test

* Update doc/source/whatsnew/v2.1.0.rst

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>

* sort hwatnsew

---------

Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
jamie-harness added a commit to jamie-harness/pandas1 that referenced this pull request Jul 26, 2023
* DEPR: argsort

* Catch warning in np.argsort test

* Update doc/source/whatsnew/v2.1.0.rst



* sort hwatnsew

---------

Co-authored-by: jbrockmendel <jbrockmendel@gmail.com>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants