@@ -341,10 +341,7 @@ def __init__(
341
341
values = _convert_to_list_like (values )
342
342
343
343
# 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
348
345
null_mask = isna (values )
349
346
if null_mask .any ():
350
347
values = [values [idx ] for idx in np .where (~ null_mask )[0 ]]
@@ -1496,7 +1493,7 @@ def check_for_ordered(self, op):
1496
1493
def _values_for_argsort (self ):
1497
1494
return self ._codes .copy ()
1498
1495
1499
- def argsort (self , ascending = True , kind = "quicksort" , * args , * *kwargs ):
1496
+ def argsort (self , ascending = True , kind = "quicksort" , ** kwargs ):
1500
1497
"""
1501
1498
Return the indices that would sort the Categorical.
1502
1499
@@ -1511,7 +1508,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
1511
1508
or descending sort.
1512
1509
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
1513
1510
Sorting algorithm.
1514
- *args, * *kwargs:
1511
+ **kwargs:
1515
1512
passed through to :func:`numpy.argsort`.
1516
1513
1517
1514
Returns
@@ -1547,7 +1544,7 @@ def argsort(self, ascending=True, kind="quicksort", *args, **kwargs):
1547
1544
>>> cat.argsort()
1548
1545
array([2, 0, 1])
1549
1546
"""
1550
- return super ().argsort (ascending = ascending , kind = kind , * args , * *kwargs )
1547
+ return super ().argsort (ascending = ascending , kind = kind , ** kwargs )
1551
1548
1552
1549
def sort_values (self , inplace = False , ascending = True , na_position = "last" ):
1553
1550
"""
0 commit comments