class_docstr: common ops mixin to support a unified interface datetimelike Index
class_docstr_tok: ["common","ops","mixin","to","support","a","unified","interface","datetimelike","Index"]
docstr: Return sorted copy of Index.
code: def sort_values(self, return_indexer=False, ascending=True):
      """
      Return sorted copy of Index.
      """
      if return_indexer:
          _as = self.argsort()
          if not ascending:
              _as = _as[::-1]
          sorted_index = self.take(_as)
          return sorted_index, _as
      else:
          sorted_values = np.sort(self._ndarray_values)
          attribs = self._get_attributes_dict()
          freq = attribs["freq"]
  
          if freq is not None and not is_period_dtype(self):
              if freq.n > 0 and not ascending:
                  freq = freq * -1
              elif freq.n < 0 and ascending:
                  freq = freq * -1
          attribs["freq"] = freq
  
          if not ascending:
              sorted_values = sorted_values[::-1]
  
          return self._simple_new(sorted_values, **attribs)
  
imports: import operator
  import warnings
  import numpy
  from pandas._libs import NaT, iNaT, lib
  from pandas.compat.numpy import function
  from pandas.errors import AbstractMethodError
  from pandas.util._decorators import Appender, cache_readonly, deprecate_kwarg
  from pandas.core.dtypes.common import ensure_int64, is_dtype_equal, is_float, is_integer, is_list_like, is_period_dtype, is_scalar
  from pandas.core.dtypes.generic import ABCIndex, ABCIndexClass, ABCSeries
  from pandas.core import algorithms, ops
  from pandas.core.accessor import PandasDelegate
  from pandas.core.arrays import ExtensionOpsMixin
  from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin, _ensure_datetimelike_to_i8
  import pandas.core.indexes.base
  from pandas.core.indexes.base import Index, _index_shared_docs
  from pandas.core.tools.timedeltas import to_timedelta
  import pandas.io.formats.printing
label_desc: Use image node_id 15 for calling the DatetimeIndexOpsMixin obj's underlying member method code with example usage: obj.sort_values(return_indexer, ascending) and returns: sorted_index,  _as, self