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] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/groupby_overrides.py#L1472-L1486)¶
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 settingcompute.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 acceptedengine_kwargs
For
'numba'
engine, the engine can acceptnopython
,nogil
andparallel
dictionary keys. The values must either beTrue
orFalse
. The defaultengine_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:
Examples
>>> s = pd.Series([1, 2, 3, 4], index=pd.Index([1, 2, 1, 2]))
>>> s 1 1 2 2 1 3 2 4 dtype: int64
>>> s.groupby(level=0).agg('min') 1 1 2 2 dtype: int64
>>> s.groupby(level=0).agg(['min', 'max']) min max 1 1 3 2 2 4