Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1922,30 +1922,30 @@ def sort_values(self, axis=0, ascending=True, inplace=False,

Examples
--------
>>> s = pd.Series([np.nan, 1, 3, 5, 10])
>>> s = pd.Series([np.nan, 1, 3, 10, 5])
>>> s
0 NaN
1 1.0
2 3.0
3 5.0
4 10.0
3 10.0
4 5.0
dtype: float64

Sort values ascending order (default behaviour)

>>> s.sort_values(ascending=True)
1 1.0
2 3.0
3 5.0
4 10.0
4 5.0
3 10.0
0 NaN
dtype: float64

Sort values descending order

>>> s.sort_values(ascending=False)
4 10.0
3 5.0
3 10.0
4 5.0
2 3.0
1 1.0
0 NaN
Expand All @@ -1955,8 +1955,8 @@ def sort_values(self, axis=0, ascending=True, inplace=False,

>>> s.sort_values(ascending=False, inplace=True)
>>> s
4 10.0
3 5.0
3 10.0
4 5.0
2 3.0
1 1.0
0 NaN
Expand All @@ -1968,8 +1968,8 @@ def sort_values(self, axis=0, ascending=True, inplace=False,
0 NaN
1 1.0
2 3.0
3 5.0
4 10.0
4 5.0
3 10.0
dtype: float64

Sort a series of strings
Expand Down