# Buggy code
def sort_index(
    self,
    axis=0,
    level=None,
    ascending=True,
    inplace=False,
    kind="quicksort",
    na_position="last",
    sort_remaining=True,
    by=None,
):
    """Sort a DataFrame by one of the indices (columns or index).

    Args:
        axis: The axis to sort over.
        level: The MultiIndex level to sort over.
        ascending: Ascending or descending
        inplace: Whether or not to update this DataFrame inplace.
        kind: How to perform the sort.
        na_position: Where to position NA on the sort.
        sort_remaining: On Multilevel Index sort based on all levels.
        by: (Deprecated) argument to pass to sort_values.

    Returns:
        A sorted DataFrame
    """
    axis = self._get_axis_number(axis)
    if level is not None:
        new_query_compiler = self._default_to_pandas(
            "sort_index",
            axis=axis,
            level=level,
            ascending=ascending,
            inplace=False,
            kind=kind,
            na_position=na_position,
            sort_remaining=sort_remaining,
        )
        return self._create_or_update_from_compiler(new_query_compiler, inplace)
    if by is not None:
        warnings.warn(
            "by argument to sort_index is deprecated, please use .sort_values(by=...)",
            FutureWarning,
            stacklevel=2,
        )
        if level is not None:
            raise ValueError("unable to simultaneously sort by and level")
        return self.sort_values(by, axis=axis, ascending=ascending, inplace=inplace)
    new_query_compiler = self._query_compiler.sort_index(
        axis=axis, ascending=ascending, kind=kind, na_position=na_position
    )
    if inplace:
        self._update_inplace(new_query_compiler=new_query_compiler)
    else:
        return self.__constructor__(query_compiler=new_query_compiler)


# Traceback (NotImplementedError)
NotImplementedError                       Traceback (most recent call last)
<ipython-input-7-06ffb9961dfc> in <module>
----> 1 hh.sort_index(axis=0)

~/.pyenv/versions/3.7.3/envs/env/lib/python3.7/site-packages/modin/pandas/base.py in sort_index(self, axis, level, ascending, inplace, kind, na_position, sort_remaining, by)
2570             return self.sort_values(by, axis=axis, ascending=ascending, inplace=inplace)
2571         new_query_compiler = self._query_compiler.sort_index(
-> 2572             axis=axis, ascending=ascending, kind=kind, na_position=na_position
2573         )
2574         if inplace:

~/.pyenv/versions/3.7.3/envs/env/lib/python3.7/site-packages/modin/backends/pandas/query_compiler.py in sort_index(self, **kwargs)
1762             new_index = self.index
1763         else:
-> 1764             new_index = pandas.Series(self.index).sort_values(**kwargs)
1765             new_columns = self.columns
1766         return self.__constructor__(

~/.pyenv/versions/3.7.3/envs/env/lib/python3.7/site-packages/pandas/core/series.py in __init__(self, data, index, dtype, name, copy, fastpath)
175
176             if isinstance(data, MultiIndex):
--> 177                 raise NotImplementedError("initializing a Series from a "
178                                           "MultiIndex is not supported")
179             elif isinstance(data, Index):

NotImplementedError: initializing a Series from a MultiIndex is not supported

# Fixed code
def sort_index(
    self,
    axis=0,
    level=None,
    ascending=True,
    inplace=False,
    kind="quicksort",
    na_position="last",
    sort_remaining=True,
    by=None,
):
    """Sort a DataFrame by one of the indices (columns or index).

    Args:
        axis: The axis to sort over.
        level: The MultiIndex level to sort over.
        ascending: Ascending or descending
        inplace: Whether or not to update this DataFrame inplace.
        kind: How to perform the sort.
        na_position: Where to position NA on the sort.
        sort_remaining: On Multilevel Index sort based on all levels.
        by: (Deprecated) argument to pass to sort_values.

    Returns:
        A sorted DataFrame
    """
    axis = self._get_axis_number(axis)
    if level is not None or (
        (axis == 0 and isinstance(self.index, pandas.MultiIndex))
        or (axis == 1 and isinstance(self.columns, pandas.MultiIndex))
    ):
        new_query_compiler = self._default_to_pandas(
            "sort_index",
            axis=axis,
            level=level,
            ascending=ascending,
            inplace=False,
            kind=kind,
            na_position=na_position,
            sort_remaining=sort_remaining,
        )._query_compiler
        return self._create_or_update_from_compiler(new_query_compiler, inplace)
    if by is not None:
        warnings.warn(
            "by argument to sort_index is deprecated, please use .sort_values(by=...)",
            FutureWarning,
            stacklevel=2,
        )
        if level is not None:
            raise ValueError("unable to simultaneously sort by and level")
        return self.sort_values(by, axis=axis, ascending=ascending, inplace=inplace)
    new_query_compiler = self._query_compiler.sort_index(
        axis=axis, ascending=ascending, kind=kind, na_position=na_position
    )
    if inplace:
        self._update_inplace(new_query_compiler=new_query_compiler)
    else:
        return self.__constructor__(query_compiler=new_query_compiler)