

def _join_monotonic(self, other, how='left', return_indexers=False):
    if self.equals(other):
        ret_index = (other if (how == 'right') else self)
        if return_indexers:
            return (ret_index, None, None)
        else:
            return ret_index
    sv = self.values
    ov = other._values
    if (self.is_unique and other.is_unique):
        if (how == 'left'):
            join_index = self
            lidx = None
            ridx = self._left_indexer_unique(sv, ov)
        elif (how == 'right'):
            join_index = other
            lidx = self._left_indexer_unique(ov, sv)
            ridx = None
        elif (how == 'inner'):
            (join_index, lidx, ridx) = self._inner_indexer(sv, ov)
            join_index = self._wrap_joined_index(join_index, other)
        elif (how == 'outer'):
            (join_index, lidx, ridx) = self._outer_indexer(sv, ov)
            join_index = self._wrap_joined_index(join_index, other)
    else:
        if (how == 'left'):
            (join_index, lidx, ridx) = self._left_indexer(sv, ov)
        elif (how == 'right'):
            (join_index, ridx, lidx) = self._left_indexer(ov, sv)
        elif (how == 'inner'):
            (join_index, lidx, ridx) = self._inner_indexer(sv, ov)
        elif (how == 'outer'):
            (join_index, lidx, ridx) = self._outer_indexer(sv, ov)
        join_index = self._wrap_joined_index(join_index, other)
    if return_indexers:
        return (join_index, lidx, ridx)
    else:
        return join_index

dataset/ETHPy150Open pydata/pandas/pandas/indexes/base.py Index._join_monotonic/original