snowflake.snowpark.modin.plugin.extensions.groupby_overrides.SeriesGroupBy.agg¶

SeriesGroupBy.agg(func: Optional[Union[Callable, str, list[Union[Callable, str]], MutableMapping[Hashable, Union[Callable, str, list[Union[Callable, str]]]]]] = None, *args: Any, engine: Optional[Literal['cython', 'numba']] = None, engine_kwargs: Optional[dict[str, bool]] = None, **kwargs: Any)[source]¶

Aggregate using one or more operations over the specified axis.

Parameters:
  • func (function, str, list, or dict) –

    Function to use for aggregating the data. If a function, must either work when passed a Series or when passed to Series.apply.

    Accepted combinations are:

    • function

    • string function name

    • list of functions and/or function names, e.g. [np.sum, 'mean']

    • dict of axis labels -> functions, function names or list of such.

  • *args – Positional arguments to pass to func.

  • engine (str, default None) –

    • 'cython' : Runs the function through C-extensions from cython.

    • 'numba' : Runs the function through JIT compiled code from numba.

    • None : Defaults to 'cython' or globally setting compute.use_numba

    This parameter is ignored in Snowpark pandas. The execution engine will always be Snowflake.

  • engine_kwargs (dict, default None) –

    • For 'cython' engine, there are no accepted engine_kwargs

    • For 'numba' engine, the engine can accept nopython, nogil and parallel dictionary keys. The values must either be True or False. The default engine_kwargs for the 'numba' engine is {'nopython': True, 'nogil': False, 'parallel': False} and will be applied to the function

    This parameter is ignored in Snowpark pandas. The execution engine will always be Snowflake.

  • **kwargs – keyword arguments to be passed into func.

Return type:

Series

Examples

>>> s = pd.Series([1, 2, 3, 4], index=pd.Index([1, 2, 1, 2]))
Copy
>>> s
1    1
2    2
1    3
2    4
dtype: int64
Copy
>>> s.groupby(level=0).agg('min')
1    1
2    2
dtype: int64
Copy
>>> s.groupby(level=0).agg(['min', 'max'])
   min  max
1    1    3
2    2    4
Copy