modin.pandas.Series.aggregate¶
- Series.aggregate(func: Union[Callable, str, list[Union[Callable, str]], MutableMapping[Hashable, Union[Callable, str, list[Union[Callable, str]]]]] = None, axis: Union[int, Literal['index', 'columns', 'rows']] = 0, *args: Any, **kwargs: Any)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/series_overrides.py#L968-L973)¶
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.
axis ({0 or 'index'}) – Unused. Parameter needed for compatibility with DataFrame.
*args – Positional arguments to pass to func.
**kwargs – Keyword arguments to pass to func.
- Returns:
The return can be:
scalar : when Snowpark pandas Series.agg is called with single function
Snowpark pandas
Series
: when Snowpark pandas DataFrame.agg is called with a single functionSnowpark pandas
DataFrame
: when Snowpark pandas DataFrame.agg is called with several functions
Return scalar, Snowpark pandas
Series
or Snowpark pandasDataFrame
.- Return type:
Notes
The aggregation operations are always performed over an axis, either the index (default) or the column axis. This behavior is different from numpy aggregation functions (mean, median, prod, sum, std, var), where the default is to compute the aggregation of the flattened array, e.g.,
numpy.mean(arr_2d)
as opposed tonumpy.mean(arr_2d, axis=0)
.agg is an alias for aggregate. Use the alias.
Functions that mutate the passed object can produce unexpected behavior or errors and are not supported.
A passed user-defined-function will be passed a Series for evaluation.
Examples
>>> s = pd.Series([1, 2, 3, 4]) >>> s 0 1 1 2 2 3 3 4 dtype: int64
>>> s.agg('min') 1
>>> s.agg(['min', 'max']) min 1 max 4 dtype: int64