def sort_index(self, **kwargs):
        axis = kwargs.pop("axis", 0)
        index = self.columns if axis else self.index
        ascending = kwargs.pop("ascending", True)
        if ascending is None:
            ascending = False
        kwargs["ascending"] = ascending
        def sort_index_builder(df, **kwargs):
            if axis:
                df.columns = index
            else:
                df.index = index
            return df.sort_index(axis=axis, **kwargs)
        func = self._prepare_method(sort_index_builder, **kwargs)
        new_data = self._map_across_full_axis(axis, func)
        if axis:
            new_columns = pandas.Series(self.columns).sort_values(**kwargs)
            new_index = self.index
        else:
            new_index = pandas.Series(self.index).sort_values(**kwargs)
            new_columns = self.columns
        return self.__constructor__(
            new_data, new_index, new_columns, self.dtypes.copy()
        )