Skip to content

Commit c87a3ee

Browse files
Damodara PudduDamodara Puddu
Damodara Puddu
authored and
Damodara Puddu
committed
DOC: Corrected Out-of-date list of sort algorithms
Reference Issues/PRs Fixes: pandas-dev#38287 Implemented changes: Changed the docstring of all the methods using np.sort as it now includes one additional stable algorithm
1 parent 122d502 commit c87a3ee

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

pandas/core/arrays/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def argsort(
561561
ascending : bool, default True
562562
Whether the indices should result in an ascending
563563
or descending sort.
564-
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
564+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
565565
Sorting algorithm.
566566
*args, **kwargs:
567567
Passed through to :func:`numpy.argsort`.

pandas/core/arrays/categorical.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ def argsort(self, ascending=True, kind="quicksort", **kwargs):
14521452
ascending : bool, default True
14531453
Whether the indices should result in an ascending
14541454
or descending sort.
1455-
kind : {'quicksort', 'mergesort', 'heapsort'}, optional
1455+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, optional
14561456
Sorting algorithm.
14571457
**kwargs:
14581458
passed through to :func:`numpy.argsort`.

pandas/core/frame.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5538,9 +5538,9 @@ def sort_index(
55385538
sort direction can be controlled for each level individually.
55395539
inplace : bool, default False
55405540
If True, perform operation in-place.
5541-
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
5542-
Choice of sorting algorithm. See also ndarray.np.sort for more
5543-
information. `mergesort` is the only stable algorithm. For
5541+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
5542+
Choice of sorting algorithm. See also :func:`numpy.sort` for more
5543+
information. `mergesort` and `stable` are the only stable algorithms. For
55445544
DataFrames, this option is only applied when sorting on a single
55455545
column or label.
55465546
na_position : {'first', 'last'}, default 'last'

pandas/core/generic.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4369,9 +4369,9 @@ def sort_values(
43694369
the by.
43704370
inplace : bool, default False
43714371
If True, perform operation in-place.
4372-
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
4373-
Choice of sorting algorithm. See also ndarray.np.sort for more
4374-
information. `mergesort` is the only stable algorithm. For
4372+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
4373+
Choice of sorting algorithm. See also :func:`numpy.sort` for more
4374+
information. `mergesort` and `stable` are the only stable algorithms. For
43754375
DataFrames, this option is only applied when sorting on a single
43764376
column or label.
43774377
na_position : {'first', 'last'}, default 'last'

pandas/core/series.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -3067,9 +3067,9 @@ def sort_values(
30673067
If True, sort values in ascending order, otherwise descending.
30683068
inplace : bool, default False
30693069
If True, perform operation in-place.
3070-
kind : {'quicksort', 'mergesort' or 'heapsort'}, default 'quicksort'
3070+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
30713071
Choice of sorting algorithm. See also :func:`numpy.sort` for more
3072-
information. 'mergesort' is the only stable algorithm.
3072+
information. 'mergesort' and 'stable' are the only stable algorithms.
30733073
na_position : {'first' or 'last'}, default 'last'
30743074
Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
30753075
the end.
@@ -3280,9 +3280,9 @@ def sort_index(
32803280
sort direction can be controlled for each level individually.
32813281
inplace : bool, default False
32823282
If True, perform operation in-place.
3283-
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
3283+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
32843284
Choice of sorting algorithm. See also :func:`numpy.sort` for more
3285-
information. 'mergesort' is the only stable algorithm. For
3285+
information. 'mergesort' and 'stable' are the only stable algorithms. For
32863286
DataFrames, this option is only applied when sorting on a single
32873287
column or label.
32883288
na_position : {'first', 'last'}, default 'last'
@@ -3421,9 +3421,9 @@ def argsort(self, axis=0, kind="quicksort", order=None) -> "Series":
34213421
----------
34223422
axis : {0 or "index"}
34233423
Has no effect but is accepted for compatibility with numpy.
3424-
kind : {'mergesort', 'quicksort', 'heapsort'}, default 'quicksort'
3425-
Choice of sorting algorithm. See np.sort for more
3426-
information. 'mergesort' is the only stable algorithm.
3424+
kind : {'mergesort', 'quicksort', 'heapsort', 'stable'}, default 'quicksort'
3425+
Choice of sorting algorithm. See :func:`numpy.sort` for more
3426+
information. 'mergesort' and 'stable' are the only stable algorithms.
34273427
order : None
34283428
Has no effect but is accepted for compatibility with numpy.
34293429

pandas/core/sorting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def get_indexer_indexer(
5454
target : Index
5555
level : int or level name or list of ints or list of level names
5656
ascending : bool or list of bools, default True
57-
kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
57+
kind : {'quicksort', 'mergesort', 'heapsort', 'stable'}, default 'quicksort'
5858
na_position : {'first', 'last'}, default 'last'
5959
sort_remaining : bool, default True
6060
key : callable, optional

0 commit comments

Comments
 (0)