# Buggy code
def _groupby_reduce(
    self, map_func, reduce_func, drop=True, numeric_only=True, **kwargs
):
    if (
        self._is_multi_by
        or self._level is not None
        or isinstance(self._df.axes[self._axis], pandas.MultiIndex)
    ):
        return self._default_to_pandas(map_func, **kwargs)

    if not isinstance(self._by, type(self._query_compiler)):
        return self._apply_agg_function(map_func, drop=drop, **kwargs)

    # For aggregations, pandas behavior does this for the result.
    # For other operations it does not, so we wait until there is an aggregation to
    # actually perform this operation.
    if self._idx_name is not None and drop:
        groupby_qc = self._query_compiler.drop(columns=[self._idx_name])
    else:
        groupby_qc = self._query_compiler

    from .dataframe import DataFrame

    return DataFrame(
        query_compiler=groupby_qc.groupby_reduce(
            self._by,
            self._axis,
            self._kwargs,
            map_func,
            kwargs,
            reduce_func=reduce_func,
            reduce_args=kwargs,
            numeric_only=numeric_only,
        )
    )


# Traceback (KeyError)
p0 Index(['data0', 'data1', 'data2'], dtype='object')
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-704c3a79c97b> in <module>()
----> 1 df_g=csv2.groupby('p0').get_group('A')

~/.local/lib/python3.7/site-packages/modin/pandas/dataframe.py in groupby(self, by, axis, level, as_index, sort, group_keys, squeeze, observed, **kwargs)
353         elif isinstance(by, string_types):
354             idx_name = by
--> 355             by = self.__getitem__(by)._query_compiler
356         elif is_list_like(by):
357             if isinstance(by, Series):

~/.local/lib/python3.7/site-packages/modin/pandas/base.py in __getitem__(self, key)
3220             return self._getitem_slice(indexer)
3221         else:
-> 3222             return self._getitem(key)
3223
3224     def _getitem_slice(self, key):

~/.local/lib/python3.7/site-packages/modin/pandas/dataframe.py in _getitem(self, key)
1835         else:
1836             print(key, self.columns)
-> 1837             return self._getitem_column(key)
1838
1839     def _getitem_column(self, key):

~/.local/lib/python3.7/site-packages/modin/pandas/dataframe.py in _getitem_column(self, key)
1839     def _getitem_column(self, key):
1840         if key not in self.keys():
-> 1841             raise KeyError("{}".format(key))
1842         s = self._reduce_dimension(self._query_compiler.getitem_column_array([key]))
1843         s._parent = self

KeyError: 'p0'

# Fixed code
def _groupby_reduce(
    self, map_func, reduce_func, drop=True, numeric_only=True, **kwargs
):
    if self._is_multi_by or self._level is not None:
        return self._default_to_pandas(map_func, **kwargs)
    if not isinstance(self._by, type(self._query_compiler)):
        return self._apply_agg_function(map_func, drop=drop, **kwargs)

    # For aggregations, pandas behavior does this for the result.
    # For other operations it does not, so we wait until there is an aggregation to
    # actually perform this operation.
    if self._idx_name is not None and drop:
        groupby_qc = self._query_compiler.drop(columns=[self._idx_name])
    else:
        groupby_qc = self._query_compiler

    from .dataframe import DataFrame

    return DataFrame(
        query_compiler=groupby_qc.groupby_reduce(
            self._by,
            self._axis,
            self._kwargs,
            map_func,
            kwargs,
            reduce_func=reduce_func,
            reduce_args=kwargs,
            numeric_only=numeric_only,
        )
    )