# Buggy code
def caller(query_compiler, other, *args, **kwargs):
    axis = kwargs.get("axis", 0)
    broadcast = kwargs.pop("broadcast", False)
    if isinstance(other, type(query_compiler)):
        if broadcast:
            assert len(other.columns) == 1, (
                "Invalid broadcast argument for `broadcast_apply`, too many columns: {}".format(
                    len(other.columns)
                )
            )
            # Transpose on `axis=1` because we always represent an individual
            # column or row as a single-column Modin DataFrame
            if axis == 1:
                other = other.transpose()
            return query_compiler.__constructor__(
                query_compiler._modin_frame.broadcast_apply(
                    axis,
                    lambda l, r: func(l, r.squeeze(), *args, **kwargs),
                    other._modin_frame,
                    preserve_labels=call_kwds.get("preserve_labels", False),
                )
            )
        else:
            join_type = call_kwds.get("join_type", "outer")
            return query_compiler.__constructor__(
                query_compiler._modin_frame._binary_op(
                    lambda x, y: func(x, y, *args, **kwargs),
                    other._modin_frame,
                    join_type=join_type,
                )
            )
    else:
        if isinstance(other, (list, np.ndarray, pandas.Series)):
            new_columns = query_compiler.columns
            new_modin_frame = query_compiler._modin_frame._apply_full_axis(
                axis,
                lambda df: func(df, other, *args, **kwargs),
                new_index=query_compiler.index,
                new_columns=new_columns,
            )
        else:
            new_modin_frame = query_compiler._modin_frame._map(
                lambda df: func(df, other, *args, **kwargs)
            )
        return query_compiler.__constructor__(new_modin_frame)


# Traceback (IndexError)
df = pd.DataFrame({"a":[1, 2 ,3]})
df.shift(-1).a / df.a
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-8-7cc3bcb4fa16> in <module>
1 df = pd.DataFrame({"a":[1, 2 ,3]})
----> 2 df.shift(-1).a / df.a

~/Envs/strategy/lib/python3.7/site-packages/modin/pandas/series.py in __truediv__(self, right)
348
349     def __truediv__(self, right):
--> 350         return self.truediv(right)
351
352     def __rtruediv__(self, left):

~/Envs/strategy/lib/python3.7/site-packages/modin/pandas/series.py in truediv(self, other, level, fill_value, axis)
1478         new_self, new_other = self._prepare_inter_op(other)
1479         return super(Series, new_self).truediv(
-> 1480             new_other, level=level, fill_value=None, axis=axis
1481         )
1482

~/Envs/strategy/lib/python3.7/site-packages/modin/pandas/base.py in truediv(self, other, axis, level, fill_value)
3299         """
3300         return self._binary_op(
-> 3301             "truediv", other, axis=axis, level=level, fill_value=fill_value
3302         )
3303

~/Envs/strategy/lib/python3.7/site-packages/modin/pandas/base.py in _binary_op(self, op, other, **kwargs)
231             )
232         other = self._validate_other(other, axis, numeric_or_object_only=True)
--> 233         new_query_compiler = getattr(self._query_compiler, op)(other, **kwargs)
234         return self._create_or_update_from_compiler(new_query_compiler)
235

~/Envs/strategy/lib/python3.7/site-packages/modin/data_management/functions/binary_function.py in caller(query_compiler, other, *args, **kwargs)
49                             lambda x, y: func(x, y, *args, **kwargs),
50                             other._modin_frame,
---> 51                             join_type=join_type,
52                         )
53                     )

~/Envs/strategy/lib/python3.7/site-packages/modin/engines/base/frame/data.py in _binary_op(self, op, right_frame, join_type)
1604         right_parts = right_parts[0]
1605         new_frame = self._frame_mgr_cls.binary_operation(
-> 1606             1, left_parts, lambda l, r: op(l, r), right_parts
1607         )
1608         new_columns = self.columns.join(right_frame.columns, how=join_type)

~/Envs/strategy/lib/python3.7/site-packages/modin/engines/base/frame/partition_manager.py in binary_operation(cls, axis, left, func, right)
753                     other_axis_partition=right_partitions[i],
754                 )
--> 755                 for i in range(len(left_partitions))
756             ]
757         )

~/Envs/strategy/lib/python3.7/site-packages/modin/engines/base/frame/partition_manager.py in <listcomp>(.0)
753                     other_axis_partition=right_partitions[i],
754                 )
--> 755                 for i in range(len(left_partitions))
756             ]
757         )

IndexError: list index out of range

# Fixed code
def caller(query_compiler, other, *args, **kwargs):
    axis = kwargs.get("axis", 0)
    broadcast = kwargs.pop("broadcast", False)
    join_type = call_kwds.get("join_type", "outer")
    if isinstance(other, type(query_compiler)):
        if broadcast:
            assert len(other.columns) == 1, (
                "Invalid broadcast argument for `broadcast_apply`, too many columns: {}".format(
                    len(other.columns)
                )
            )
            # Transpose on `axis=1` because we always represent an individual
            # column or row as a single-column Modin DataFrame
            if axis == 1:
                other = other.transpose()
            return query_compiler.__constructor__(
                query_compiler._modin_frame.broadcast_apply(
                    axis,
                    lambda l, r: func(l, r.squeeze(), *args, **kwargs),
                    other._modin_frame,
                    join_type=join_type,
                    preserve_labels=call_kwds.get("preserve_labels", False),
                )
            )
        else:
            return query_compiler.__constructor__(
                query_compiler._modin_frame._binary_op(
                    lambda x, y: func(x, y, *args, **kwargs),
                    other._modin_frame,
                    join_type=join_type,
                )
            )
    else:
        if isinstance(other, (list, np.ndarray, pandas.Series)):
            new_columns = query_compiler.columns
            new_modin_frame = query_compiler._modin_frame._apply_full_axis(
                axis,
                lambda df: func(df, other, *args, **kwargs),
                new_index=query_compiler.index,
                new_columns=new_columns,
            )
        else:
            new_modin_frame = query_compiler._modin_frame._map(
                lambda df: func(df, other, *args, **kwargs)
            )
        return query_compiler.__constructor__(new_modin_frame)