Skip to content

Commit 1af72ee

Browse files
simonjayhawkinsroberthdevries
authored andcommitted
TYP: check_untyped_defs core.arrays.categorical (pandas-dev#32097)
1 parent 80cc6bb commit 1af72ee

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

pandas/core/arrays/categorical.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,7 @@ def __init__(
341341
values = _convert_to_list_like(values)
342342

343343
# By convention, empty lists result in object dtype:
344-
if len(values) == 0:
345-
sanitize_dtype = "object"
346-
else:
347-
sanitize_dtype = None
344+
sanitize_dtype = "object" if len(values) == 0 else None
348345
null_mask = isna(values)
349346
if null_mask.any():
350347
values = [values[idx] for idx in np.where(~null_mask)[0]]
@@ -1496,7 +1493,7 @@ def check_for_ordered(self, op):
14961493
def _values_for_argsort(self):
14971494
return self._codes.copy()
14981495

1499-
def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
1496+
def argsort(self, ascending=True, kind="quicksort", **kwargs):
15001497
"""
15011498
Return the indices that would sort the Categorical.
15021499
@@ -1511,7 +1508,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
15111508
or descending sort.
15121509
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
15131510
Sorting algorithm.
1514-
*args, **kwargs:
1511+
**kwargs:
15151512
passed through to :func:`numpy.argsort`.
15161513
15171514
Returns
@@ -1547,7 +1544,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
15471544
>>> cat.argsort()
15481545
array([2, 0, 1])
15491546
"""
1550-
return super().argsort(ascending=ascending, kind=kind, *args, **kwargs)
1547+
return super().argsort(ascending=ascending, kind=kind, **kwargs)
15511548

15521549
def sort_values(self, inplace=False, ascending=True, na_position="last"):
15531550
"""

setup.cfg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ check_untyped_defs=False
147147
[mypy-pandas._version]
148148
check_untyped_defs=False
149149

150-
[mypy-pandas.core.arrays.categorical]
151-
check_untyped_defs=False
152-
153150
[mypy-pandas.core.arrays.interval]
154151
check_untyped_defs=False
155152

0 commit comments

Comments
 (0)