@@ -1356,10 +1356,18 @@ def combine_first(self, other):
1356
1356
1357
1357
def sort (self , axis = 0 , kind = 'quicksort' , order = None ):
1358
1358
"""
1359
- Sort values and index labels in place, for compatibility with
1360
- ndarray. No return value
1359
+ Sort values and index labels by value, in place. For compatibility with
1360
+ ndarray API. No return value
1361
+
1362
+ Parameters
1363
+ ----------
1364
+ axis : int (can only be zero)
1365
+ kind : {'mergesort', 'quicksort', 'heapsort'}, default 'quicksort'
1366
+ Choice of sorting algorithm. See np.sort for more
1367
+ information. 'mergesort' is the only stable algorithm
1368
+ order : ignored
1361
1369
"""
1362
- sortedSeries = self .order (na_last = True )
1370
+ sortedSeries = self .order (na_last = True , kind = kind )
1363
1371
1364
1372
true_base = self
1365
1373
while true_base .base is not None :
@@ -1399,6 +1407,14 @@ def argsort(self, axis=0, kind='quicksort', order=None):
1399
1407
Overrides ndarray.argsort. Argsorts the value, omitting NA/null values,
1400
1408
and places the result in the same locations as the non-NA values
1401
1409
1410
+ Parameters
1411
+ ----------
1412
+ axis : int (can only be zero)
1413
+ kind : {'mergesort', 'quicksort', 'heapsort'}, default 'quicksort'
1414
+ Choice of sorting algorithm. See np.sort for more
1415
+ information. 'mergesort' is the only stable algorithm
1416
+ order : ignored
1417
+
1402
1418
Returns
1403
1419
-------
1404
1420
argsorted : Series
@@ -1409,10 +1425,11 @@ def argsort(self, axis=0, kind='quicksort', order=None):
1409
1425
if mask .any ():
1410
1426
result = values .copy ()
1411
1427
notmask = - mask
1412
- result [notmask ] = np .argsort (values [notmask ])
1428
+ result [notmask ] = np .argsort (values [notmask ], kind = kind )
1413
1429
return Series (result , index = self .index , name = self .name )
1414
1430
else :
1415
- return Series (np .argsort (values ), index = self .index , name = self .name )
1431
+ return Series (np .argsort (values , kind = kind ), index = self .index ,
1432
+ name = self .name )
1416
1433
1417
1434
def rank (self ):
1418
1435
"""
@@ -1429,7 +1446,7 @@ def rank(self):
1429
1446
ranks = lib .rank_1d_generic (self .values )
1430
1447
return Series (ranks , index = self .index , name = self .name )
1431
1448
1432
- def order (self , na_last = True , ascending = True ):
1449
+ def order (self , na_last = True , ascending = True , kind = 'mergesort' ):
1433
1450
"""
1434
1451
Sorts Series object, by value, maintaining index-value link
1435
1452
@@ -1439,6 +1456,9 @@ def order(self, na_last=True, ascending=True):
1439
1456
Put NaN's at beginning or end
1440
1457
ascending : boolean, default True
1441
1458
Sort ascending. Passing False sorts descending
1459
+ kind : {'mergesort', 'quicksort', 'heapsort'}, default 'mergesort'
1460
+ Choice of sorting algorithm. See np.sort for more
1461
+ information. 'mergesort' is the only stable algorith
1442
1462
1443
1463
Returns
1444
1464
-------
0 commit comments