Skip to content

Commit 2ebc13d

Browse files
committed
ENH: Allow sorting of Series in ascending order
1 parent 8abd501 commit 2ebc13d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/core/series.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -2012,7 +2012,7 @@ def dot(self, other):
20122012
20132013
Parameters
20142014
----------
2015-
other : Series or DataFrame
2015+
other : Series or DataFrame
20162016
20172017
Returns
20182018
-------
@@ -2194,7 +2194,7 @@ def update(self, other):
21942194
#----------------------------------------------------------------------
21952195
# Reindexing, sorting
21962196

2197-
def sort(self, axis=0, kind='quicksort', order=None):
2197+
def sort(self, axis=0, kind='quicksort', order=None, ascending=True):
21982198
"""
21992199
Sort values and index labels by value, in place. For compatibility with
22002200
ndarray API. No return value
@@ -2206,8 +2206,15 @@ def sort(self, axis=0, kind='quicksort', order=None):
22062206
Choice of sorting algorithm. See np.sort for more
22072207
information. 'mergesort' is the only stable algorithm
22082208
order : ignored
2209+
ascending : boolean, default True
2210+
Sort ascending. Passing False sorts descending
2211+
2212+
See Also
2213+
--------
2214+
pandas.Series.order
22092215
"""
2210-
sortedSeries = self.order(na_last=True, kind=kind)
2216+
sortedSeries = self.order(na_last=True, kind=kind,
2217+
ascending=ascending)
22112218

22122219
true_base = self
22132220
while true_base.base is not None:

0 commit comments

Comments
 (0)