pandas 1.4.2

NotesParametersReturnsBackRef
aggregate(self, func, *args, **kwargs)

Notes

:None:None:`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. See gotchas.udf-mutation for more details.

A passed user-defined-function will be passed a Series for evaluation.

Parameters

func : function, str, list or dict

Function to use for aggregating the data. If a function, must either work when passed a Series/Dataframe or when passed to Series/Dataframe.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 .

**kwargs :

Keyword arguments to pass to func .

Returns

scalar, Series or DataFrame

The return can be:

Aggregate using one or more operations over the specified axis.

See Also

pandas.DataFrame.rolling

Calling object with DataFrame data.

pandas.Series.rolling

Calling object with Series data.

Examples

This example is valid syntax, but we were not able to check execution
>>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]})
... df A B C 0 1 4 7 1 2 5 8 2 3 6 9
This example is valid syntax, but we were not able to check execution
>>> df.rolling(2).sum()
     A     B     C
0  NaN   NaN   NaN
1  3.0   9.0  15.0
2  5.0  11.0  17.0
This example is valid syntax, but we were not able to check execution
>>> df.rolling(2).agg({"A": "sum", "B": "min"})
     A    B
0  NaN  NaN
1  3.0  4.0
2  5.0  5.0
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.window.rolling.Rolling.aggregate

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/window/rolling.py#1728
type: <class 'function'>
Commit: