bigframes.pandas.api.typing.Window.agg#

Window.agg(func) df.DataFrame | series.Series[source]#

Aggregate using one or more operations over the specified axis.

Examples:

>>> import bigframes.pandas as bpd
>>> df = bpd.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

[3 rows x 3 columns]
>>> df.rolling(2).sum()
      A     B     C
0  <NA>  <NA>  <NA>
1     3     9    15
2     5    11    17

[3 rows x 3 columns]
>>> df.rolling(2).agg({"A": "sum", "B": "min"})
      A    B
0  <NA> <NA>
1     3    4
2     5    5

[3 rows x 2 columns]
Parameters:

func (function, str, list or dict) –

Function to use for aggregating the data.

Accepted combinations are:

  • string function name

  • list of function names, e.g. ['sum', 'mean']

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

Returns:

Series or DataFrame