# Buggy code
def groupby(
    self,
    by=None,
    axis=0,
    level=None,
    as_index=True,
    sort=True,
    group_keys=True,
    squeeze=False,
    observed=False,
    **kwargs,
):
    """Apply a groupby to this DataFrame. See _groupby() remote task.
    Args:
        by: The value to groupby.
        axis: The axis to groupby.
        level: The level of the groupby.
        as_index: Whether or not to store result as index.
        sort: Whether or not to sort the result by the index.
        group_keys: Whether or not to group the keys.
        squeeze: Whether or not to squeeze.
    Returns:
        A new DataFrame resulting from the groupby.
    """
    axis = self._get_axis_number(axis)
    idx_name = None
    if callable(by):
        by = by(self.index)
    elif isinstance(by, string_types):
        idx_name = by
        by = self.__getitem__(by)._query_compiler
    elif is_list_like(by):
        if isinstance(by, Series):
            idx_name = by.name
            by = by.values
        mismatch = len(by) != len(self) if axis == 0 else len(by) != len(self.columns)
        if mismatch and all(obj in self for obj in by):
            # In the future, we will need to add logic to handle this, but for now
            # we default to pandas in this case.
            pass
        elif mismatch:
            raise KeyError(next(x for x in by if x not in self))

    from .groupby import DataFrameGroupBy

    return DataFrameGroupBy(
        self,
        by,
        axis,
        level,
        as_index,
        sort,
        group_keys,
        squeeze,
        idx_name,
        observed=observed,
        **kwargs,
    )


# Traceback (TypeError)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-e142f2bb04bf> in <module>()
----> 1 g2=csv2.groupby(by=lambda x:x[1]<3)

~/.local/lib/python3.7/site-packages/modin/pandas/dataframe.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, **kwargs)
350         idx_name = None
351         if callable(by):
--> 352             by = by(self.index)
353         elif isinstance(by, string_types):
354             idx_name = by

<ipython-input-16-e142f2bb04bf> in <lambda>(x)
----> 1 g2=csv2.groupby(by=lambda x:x[1]<3)

TypeError: '<' not supported between instances of 'tuple' and 'int'

# Fixed code
def groupby(
    self,
    by=None,
    axis=0,
    level=None,
    as_index=True,
    sort=True,
    group_keys=True,
    squeeze=False,
    observed=False,
    **kwargs,
):
    """Apply a groupby to this DataFrame. See _groupby() remote task.
    Args:
        by: The value to groupby.
        axis: The axis to groupby.
        level: The level of the groupby.
        as_index: Whether or not to store result as index.
        sort: Whether or not to sort the result by the index.
        group_keys: Whether or not to group the keys.
        squeeze: Whether or not to squeeze.
    Returns:
        A new DataFrame resulting from the groupby.
    """
    axis = self._get_axis_number(axis)
    idx_name = None
    if callable(by):
        by = self.index.map(by)
    elif isinstance(by, string_types):
        idx_name = by
        by = self.__getitem__(by)._query_compiler
    elif is_list_like(by):
        if isinstance(by, Series):
            idx_name = by.name
            by = by.values
        mismatch = len(by) != len(self) if axis == 0 else len(by) != len(self.columns)
        if mismatch and all(obj in self for obj in by):
            # In the future, we will need to add logic to handle this, but for now
            # we default to pandas in this case.
            pass
        elif mismatch:
            raise KeyError(next(x for x in by if x not in self))

    from .groupby import DataFrameGroupBy

    return DataFrameGroupBy(
        self,
        by,
        axis,
        level,
        as_index,
        sort,
        group_keys,
        squeeze,
        idx_name,
        observed=observed,
        **kwargs,
    )