(self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last')
return _sdc_pandas_series_sort_values_impl
Intel Scalable Dataframe Compiler User Guide
    ********************************************

    Pandas API: pandas.Series.sort_values

    Limitations
    -----------
    - Parameter ``inplace`` is supported only with default value ``False``.
    - Parameter ``axis`` is currently unsupported by Intel Scalable Dataframe Compiler.
    - Parameter ``kind`` is supported only with values ``'mergesort'`` and ``'quicksort'``.
    - This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff
    between staying in JIT-region with that function or going back to interpreter mode.

    Examples
    --------
    .. literalinclude:: ../../../examples/series/series_sort_values.py
       :language: python
       :lines: 36-
       :caption: Sort by the values.
       :name: ex_series_sort_values

    .. command-output:: python ./series/series_sort_values.py
       :cwd: ../../../examples

    .. seealso::

        :ref:`Series.sort_index <pandas.Series.sort_index>`
            Sort by the Series indices.

        :ref:`DataFrame.sort_values <pandas.DataFrame.sort_values>`
            Sort DataFrame by the values along either axis.

        :ref:`DataFrame.sort_index <pandas.DataFrame.sort_index>`
            Sort DataFrame by indices.

    Intel Scalable Dataframe Compiler Developer Guide
    *************************************************
    Pandas Series method :meth:`pandas.Series.sort_values` implementation.

    .. only:: developer
        Test: python -m sdc.runtests -k sdc.tests.test_series.TestSeries.test_series_sort_values*
Intel Scalable Dataframe Compiler User Guide
    ********************************************
Intel Scalable Dataframe Compiler User Guide ********************************************
def hpat_pandas_series_sort_values(self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'):
    """
    Intel Scalable Dataframe Compiler User Guide
    ********************************************

    Pandas API: pandas.Series.sort_values

    Limitations
    -----------
    - Parameter ``inplace`` is supported only with default value ``False``.
    - Parameter ``axis`` is currently unsupported by Intel Scalable Dataframe Compiler.
    - Parameter ``kind`` is supported only with values ``'mergesort'`` and ``'quicksort'``.
    - This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff
    between staying in JIT-region with that function or going back to interpreter mode.

    Examples
    --------
    .. literalinclude:: ../../../examples/series/series_sort_values.py
       :language: python
       :lines: 36-
       :caption: Sort by the values.
       :name: ex_series_sort_values

    .. command-output:: python ./series/series_sort_values.py
       :cwd: ../../../examples

    .. seealso::

        :ref:`Series.sort_index <pandas.Series.sort_index>`
            Sort by the Series indices.

        :ref:`DataFrame.sort_values <pandas.DataFrame.sort_values>`
            Sort DataFrame by the values along either axis.

        :ref:`DataFrame.sort_index <pandas.DataFrame.sort_index>`
            Sort DataFrame by indices.

    Intel Scalable Dataframe Compiler Developer Guide
    *************************************************
    Pandas Series method :meth:`pandas.Series.sort_values` implementation.

    .. only:: developer
        Test: python -m sdc.runtests -k sdc.tests.test_series.TestSeries.test_series_sort_values*
    """

    _func_name = 'Method sort_values().'

    ty_checker = TypeChecker('Method sort_values().')
    ty_checker.check(self, SeriesType)

    axis_supported_types = (int, types.Omitted, types.Integer, types.StringLiteral, types.UnicodeType)
    if not isinstance(axis, axis_supported_types):
        ty_checker.raise_exc(axis, 'integer or string', 'axis')

    ascending_supported_types = (bool, types.Omitted, types.Boolean)
    if not isinstance(ascending, ascending_supported_types):
        ty_checker.raise_exc(ascending, 'boolean', 'ascending')

    kind_supported_types = (str, types.Omitted, types.NoneType, types.StringLiteral, types.UnicodeType)
    if not isinstance(kind, kind_supported_types):
        ty_checker.raise_exc(kind, 'string', 'kind')
    kind_is_none_or_default = isinstance(kind, (str, types.Omitted, types.NoneType))

    na_position_supported_types = (str, types.Omitted, types.StringLiteral, types.UnicodeType)
    if not isinstance(na_position, na_position_supported_types):
        ty_checker.raise_exc(na_position, 'string', 'na_position')

    if not (inplace is False or isinstance(inplace, types.Omitted)):
        raise TypingError('{} Unsupported parameters. Given inplace: {}'.format(_func_name, inplace))

    def _sdc_pandas_series_sort_values_impl(
            self, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last'):

        common_functions._sdc_pandas_series_check_axis(axis)

        if not (kind_is_none_or_default or kind in ('quicksort', 'mergesort')):
            raise ValueError("Method sort_values(). Unsupported parameter. Given kind != 'quicksort', 'mergesort'")

        if na_position not in ('last', 'first'):
            raise ValueError("Method sort_values(). Unsupported parameter. Given na_position != 'last', 'first'")

        data_nan_mask = sdc.hiframes.api.get_nan_mask(self._data)
        good = ~data_nan_mask

        if kind_is_none_or_default == True:  # noqa
            argsort_res = sdc_arrays_argsort(self._data[good], kind='quicksort', ascending=ascending)
        else:
            argsort_res = sdc_arrays_argsort(self._data[good], kind=kind, ascending=ascending)

        idx = numpy.arange(len(self), dtype=numpy.int32)
        sorted_index = numpy.empty(len(self), dtype=numpy.int32)
        if na_position == "last":
            nans_start, nans_stop = good.sum(), len(self)
            sorted_index[:nans_start] = idx[good][argsort_res]
            sorted_index[nans_start: nans_stop] = idx[data_nan_mask]
        elif na_position == "first":
            nans_start, nans_stop = 0, data_nan_mask.sum()
            sorted_index[nans_stop:] = idx[good][argsort_res]
            sorted_index[:nans_stop] = idx[data_nan_mask]

        result_data = self._data[sorted_index]
        result_index = self.index[sorted_index]

        return pandas.Series(data=result_data, index=result_index, name=self._name)

    return _sdc_pandas_series_sort_values_impl
def hpat_pandas_series_sort_values ( self , axis = 0 , ascending = True , inplace = False , kind = 'quicksort' , na_position = 'last' ) : _func_name = 'Method sort_values().' ty_checker = TypeChecker ( 'Method sort_values().' ) ty_checker . check ( self , SeriesType ) axis_supported_types = ( int , types . Omitted , types . Integer , types . StringLiteral , types . UnicodeType ) if not isinstance ( axis , axis_supported_types ) : ty_checker . raise_exc ( axis , 'integer or string' , 'axis' ) ascending_supported_types = ( bool , types . Omitted , types . Boolean ) if not isinstance ( ascending , ascending_supported_types ) : ty_checker . raise_exc ( ascending , 'boolean' , 'ascending' ) kind_supported_types = ( str , types . Omitted , types . NoneType , types . StringLiteral , types . UnicodeType ) if not isinstance ( kind , kind_supported_types ) : ty_checker . raise_exc ( kind , 'string' , 'kind' ) kind_is_none_or_default = isinstance ( kind , ( str , types . Omitted , types . NoneType ) ) na_position_supported_types = ( str , types . Omitted , types . StringLiteral , types . UnicodeType ) if not isinstance ( na_position , na_position_supported_types ) : ty_checker . raise_exc ( na_position , 'string' , 'na_position' ) if not ( inplace is False or isinstance ( inplace , types . Omitted ) ) : raise TypingError ( '{} Unsupported parameters. Given inplace: {}' . format ( _func_name , inplace ) ) def _sdc_pandas_series_sort_values_impl ( self , axis = 0 , ascending = True , inplace = False , kind = 'quicksort' , na_position = 'last' ) : common_functions . _sdc_pandas_series_check_axis ( axis ) if not ( kind_is_none_or_default or kind in ( 'quicksort' , 'mergesort' ) ) : raise ValueError ( "Method sort_values(). Unsupported parameter. Given kind != 'quicksort', 'mergesort'" ) if na_position not in ( 'last' , 'first' ) : raise ValueError ( "Method sort_values(). Unsupported parameter. Given na_position != 'last', 'first'" ) data_nan_mask = sdc . hiframes . api . get_nan_mask ( self . _data ) good = ~ data_nan_mask if kind_is_none_or_default == True : # noqa argsort_res = sdc_arrays_argsort ( self . _data [ good ] , kind = 'quicksort' , ascending = ascending ) else : argsort_res = sdc_arrays_argsort ( self . _data [ good ] , kind = kind , ascending = ascending ) idx = numpy . arange ( len ( self ) , dtype = numpy . int32 ) sorted_index = numpy . empty ( len ( self ) , dtype = numpy . int32 ) if na_position == "last" : nans_start , nans_stop = good . sum ( ) , len ( self ) sorted_index [ : nans_start ] = idx [ good ] [ argsort_res ] sorted_index [ nans_start : nans_stop ] = idx [ data_nan_mask ] elif na_position == "first" : nans_start , nans_stop = 0 , data_nan_mask . sum ( ) sorted_index [ nans_stop : ] = idx [ good ] [ argsort_res ] sorted_index [ : nans_stop ] = idx [ data_nan_mask ] result_data = self . _data [ sorted_index ] result_index = self . index [ sorted_index ] return pandas . Series ( data = result_data , index = result_index , name = self . _name ) return _sdc_pandas_series_sort_values_impl