modin/core/dataframe/algebra/default2pandas/groupby.py
def build_aggregate_method(cls, key):
        """
        Build function for `QueryCompiler.groupby_agg` that can be executed as default-to-pandas.

        Parameters
        ----------
        key : callable or str
            Default aggregation function. If aggregation function is not specified
            via groupby arguments, then `key` function is used.

        Returns
        -------
        callable
            Function that executes groupby aggregation.
        """

        def fn(
            df,
            by,
            groupby_args,
            agg_args,
            axis=0,
            is_multi_by=None,
            drop=False,
            **kwargs
        ):
            """Group DataFrame and apply aggregation function to each group."""
            by = cls.validate_by(by)

            grp = df.groupby(by, axis=axis, **groupby_args)
            agg_func = cls.get_func(grp, key, **kwargs)
            result = (
                grp.agg(agg_func, **agg_args)
                if isinstance(agg_func, dict)
                else agg_func(grp, **agg_args)
            )

            return result

        return fn

        Build function for `QueryCompiler.groupby_agg` that can be executed as default-to-pandas.

        Parameters
        ----------
        key : callable or str
            Default aggregation function. If aggregation function is not specified
            via groupby arguments, then `key` function is used.

        Returns
        -------
        callable
            Function that executes groupby aggregation.
        
Build function for `QueryCompiler.groupby_agg` that can be executed as default-to-pandas.
Parameters

key : callable or str
Default aggregation function. If aggregation function is not specified
via groupby arguments, then `key` function is used.

Returns

callable
Function that executes groupby aggregation.
Build function for ` QueryCompiler . groupby_agg ` that can be executed as default - to - pandas . Parameters key : callable or str Default aggregation function . If aggregation function is not specified via groupby arguments then ` key ` function is used . Returns callable Function that executes groupby aggregation .
def build_aggregate_method(cls, key):
        def fn(
            df,
            by,
            groupby_args,
            agg_args,
            axis=0,
            is_multi_by=None,
            drop=False,
            **kwargs
        ):
            by = cls.validate_by(by)
            grp = df.groupby(by, axis=axis, **groupby_args)
            agg_func = cls.get_func(grp, key, **kwargs)
            result = (
                grp.agg(agg_func, **agg_args)
                if isinstance(agg_func, dict)
                else agg_func(grp, **agg_args)
            )
            return result
        return fn
def build_aggregate_method ( cls , key ) : def fn ( df , by , groupby_args , agg_args , axis = 0 , is_multi_by = None , drop = False , ** kwargs ) : """Group DataFrame and apply aggregation function to each group.""" by = cls . validate_by ( by ) grp = df . groupby ( by , axis = axis , ** groupby_args ) agg_func = cls . get_func ( grp , key , ** kwargs ) result = ( grp . agg ( agg_func , ** agg_args ) if isinstance ( agg_func , dict ) else agg_func ( grp , ** agg_args ) ) return result return fn
Build function for `QueryCompiler.groupby_agg` that can be executed as default-to-pandas.
Build function for ` QueryCompiler . groupby_agg ` that can be executed as default - to - pandas .
"""
        Build function for `QueryCompiler.groupby_agg` that can be executed as default-to-pandas.

        Parameters
        ----------
        key : callable or str
            Default aggregation function. If aggregation function is not specified
            via groupby arguments, then `key` function is used.

        Returns
        -------
        callable
            Function that executes groupby aggregation.
        """ """Group DataFrame and apply aggregation function to each group."""
cls
key