def sort_values(self, axis=<NUM_LIT:0>, ascending=True, inplace=False,<EOL>kind='<STR_LIT>', na_position='<STR_LIT>'):
inplace = validate_bool_kwarg(inplace, '<STR_LIT>')<EOL>self._get_axis_number(axis)<EOL>if inplace and self._is_cached:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>")<EOL><DEDENT>def _try_kind_sort(arr):<EOL><INDENT>try:<EOL><INDENT>return arr.argsort(kind=kind)<EOL><DEDENT>except TypeError:<EOL><INDENT>return arr.argsort(kind='<STR_LIT>')<EOL><DEDENT><DEDENT>arr = self._values<EOL>sortedIdx = np.empty(len(self), dtype=np.int32)<EOL>bad = isna(arr)<EOL>good = ~bad<EOL>idx = ibase.default_index(len(self))<EOL>argsorted = _try_kind_sort(arr[good])<EOL>if is_list_like(ascending):<EOL><INDENT>if len(ascending) != <NUM_LIT:1>:<EOL><INDENT>raise ValueError('<STR_LIT>'<EOL>'<STR_LIT>' % (len(ascending)))<EOL><DEDENT>ascending = ascending[<NUM_LIT:0>]<EOL><DEDENT>if not is_bool(ascending):<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>if not ascending:<EOL><INDENT>argsorted = argsorted[::-<NUM_LIT:1>]<EOL><DEDENT>if na_position == '<STR_LIT>':<EOL><INDENT>n = good.sum()<EOL>sortedIdx[:n] = idx[good][argsorted]<EOL>sortedIdx[n:] = idx[bad]<EOL><DEDENT>elif na_position == '<STR_LIT>':<EOL><INDENT>n = bad.sum()<EOL>sortedIdx[n:] = idx[good][argsorted]<EOL>sortedIdx[:n] = idx[bad]<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>'.format(na_position))<EOL><DEDENT>result = self._constructor(arr[sortedIdx], index=self.index[sortedIdx])<EOL>if inplace:<EOL><INDENT>self._update_inplace(result)<EOL><DEDENT>else:<EOL><INDENT>return result.__finalize__(self)<EOL><DEDENT>
Sort by the values.

Sort a Series in ascending or descending order by some
criterion.

Parameters
----------
axis : {0 or 'index'}, default 0
    Axis to direct sorting. The value 'index' is accepted for
    compatibility with DataFrame.sort_values.
ascending : bool, default True
    If True, sort values in ascending order, otherwise descending.
inplace : bool, default False
    If True, perform operation in-place.
kind : {'quicksort', 'mergesort' or 'heapsort'}, default 'quicksort'
    Choice of sorting algorithm. See also :func:`numpy.sort` for more
    information. 'mergesort' is the only stable  algorithm.
na_position : {'first' or 'last'}, default 'last'
    Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
    the end.

Returns
-------
Series
    Series ordered by values.

See Also
--------
Series.sort_index : Sort by the Series indices.
DataFrame.sort_values : Sort DataFrame by the values along either axis.
DataFrame.sort_index : Sort DataFrame by indices.

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

Sort values descending order

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

Sort values inplace

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

Sort values putting NAs first

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

Sort a series of strings

>>> s = pd.Series(['z', 'b', 'd', 'a', 'c'])
>>> s
0    z
1    b
2    d
3    a
4    c
dtype: object

>>> s.sort_values()
3    a
1    b
4    c
2    d
0    z
dtype: object