Skip to content

Commit b7b0558

Browse files
authored
DEPR: non-keyword args in EA.argsort (#46134)
1 parent c492672 commit b7b0558

File tree

4 files changed

+11
-2
lines changed

4 files changed

+11
-2
lines changed

doc/source/whatsnew/v1.5.0.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,8 @@ Other Deprecations
243243
- Deprecated treating float-dtype data as wall-times when passed with a timezone to :class:`Series` or :class:`DatetimeIndex` (:issue:`45573`)
244244
- 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`)
245245
- Deprecated the ``warn`` parameter in :func:`infer_freq` (:issue:`45947`)
246-
246+
- Deprecated allowing non-keyword arguments in :meth:`ExtensionArray.argsort` (:issue:`46134`)
247+
-
247248

248249
.. ---------------------------------------------------------------------------
249250
.. _whatsnew_150.performance:

pandas/core/arrays/base.py

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
Appender,
4444
Substitution,
4545
cache_readonly,
46+
deprecate_nonkeyword_arguments,
4647
)
4748
from pandas.util._validators import (
4849
validate_bool_kwarg,
@@ -642,6 +643,7 @@ def _values_for_argsort(self) -> np.ndarray:
642643
# Note: this is used in `ExtensionArray.argsort/argmin/argmax`.
643644
return np.array(self)
644645

646+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
645647
def argsort(
646648
self,
647649
ascending: bool = True,

pandas/core/arrays/categorical.py

+2
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from pandas.util._decorators import (
4646
cache_readonly,
4747
deprecate_kwarg,
48+
deprecate_nonkeyword_arguments,
4849
)
4950
from pandas.util._exceptions import find_stack_level
5051
from pandas.util._validators import validate_bool_kwarg
@@ -1717,6 +1718,7 @@ def check_for_ordered(self, op):
17171718
"Categorical to an ordered one\n"
17181719
)
17191720

1721+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
17201722
def argsort(self, ascending=True, kind="quicksort", **kwargs):
17211723
"""
17221724
Return the indices that would sort the Categorical.

pandas/core/arrays/interval.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@
3737
)
3838
from pandas.compat.numpy import function as nv
3939
from pandas.errors import IntCastingNaNError
40-
from pandas.util._decorators import Appender
40+
from pandas.util._decorators import (
41+
Appender,
42+
deprecate_nonkeyword_arguments,
43+
)
4144

4245
from pandas.core.dtypes.cast import LossySetitemError
4346
from pandas.core.dtypes.common import (
@@ -776,6 +779,7 @@ def __lt__(self, other):
776779
def __le__(self, other):
777780
return self._cmp_method(other, operator.le)
778781

782+
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
779783
def argsort(
780784
self,
781785
ascending: bool = True,

0 commit comments

Comments
 (0)