def sort_values(self, return_indexer=False, ascending=True):
if return_indexer:<EOL><INDENT>_as = self.argsort()<EOL>if not ascending:<EOL><INDENT>_as = _as[::-<NUM_LIT:1>]<EOL><DEDENT>sorted_index = self.take(_as)<EOL>return sorted_index, _as<EOL><DEDENT>else:<EOL><INDENT>sorted_values = np.sort(self._ndarray_values)<EOL>attribs = self._get_attributes_dict()<EOL>freq = attribs['<STR_LIT>']<EOL>if freq is not None and not is_period_dtype(self):<EOL><INDENT>if freq.n > <NUM_LIT:0> and not ascending:<EOL><INDENT>freq = freq * -<NUM_LIT:1><EOL><DEDENT>elif freq.n < <NUM_LIT:0> and ascending:<EOL><INDENT>freq = freq * -<NUM_LIT:1><EOL><DEDENT><DEDENT>attribs['<STR_LIT>'] = freq<EOL>if not ascending:<EOL><INDENT>sorted_values = sorted_values[::-<NUM_LIT:1>]<EOL><DEDENT>return self._simple_new(sorted_values, **attribs)<EOL><DEDENT>
Return sorted copy of Index.