Skip to content

Commit

Permalink
DEPR: non-keyword args in EA.argsort (pandas-dev#46134)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored Feb 26, 2022
1 parent c492672 commit b7b0558
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
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 @@ -1717,6 +1718,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

0 comments on commit b7b0558

Please sign in to comment.