Skip to content

DEPR: non-keyword args in EA.argsort #46134

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
merged 2 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v1.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,8 @@ Other Deprecations
- Deprecated treating float-dtype data as wall-times when passed with a timezone to :class:`Series` or :class:`DatetimeIndex` (:issue:`45573`)
- Deprecated the behavior of :meth:`Series.fillna` and :meth:`DataFrame.fillna` with ``timedelta64[ns]`` dtype and incompatible fill value; in a future version this will cast to a common dtype (usually object) instead of raising, matching the behavior of other dtypes (:issue:`45746`)
- Deprecated the ``warn`` parameter in :func:`infer_freq` (:issue:`45947`)

- Deprecated allowing non-keyword arguments in :meth:`ExtensionArray.argsort` (:issue:`46134`)
-

.. ---------------------------------------------------------------------------
.. _whatsnew_150.performance:
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
Appender,
Substitution,
cache_readonly,
deprecate_nonkeyword_arguments,
)
from pandas.util._validators import (
validate_bool_kwarg,
Expand Down Expand Up @@ -642,6 +643,7 @@ def _values_for_argsort(self) -> np.ndarray:
# Note: this is used in `ExtensionArray.argsort/argmin/argmax`.
return np.array(self)

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def argsort(
self,
ascending: bool = True,
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
from pandas.util._decorators import (
cache_readonly,
deprecate_kwarg,
deprecate_nonkeyword_arguments,
)
from pandas.util._exceptions import find_stack_level
from pandas.util._validators import validate_bool_kwarg
Expand Down Expand Up @@ -1716,6 +1717,7 @@ def check_for_ordered(self, op):
"Categorical to an ordered one\n"
)

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def argsort(self, ascending=True, kind="quicksort", **kwargs):
"""
Return the indices that would sort the Categorical.
Expand Down
6 changes: 5 additions & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@
)
from pandas.compat.numpy import function as nv
from pandas.errors import IntCastingNaNError
from pandas.util._decorators import Appender
from pandas.util._decorators import (
Appender,
deprecate_nonkeyword_arguments,
)

from pandas.core.dtypes.cast import LossySetitemError
from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -776,6 +779,7 @@ def __lt__(self, other):
def __le__(self, other):
return self._cmp_method(other, operator.le)

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def argsort(
self,
ascending: bool = True,
Expand Down