bigframes.pandas.api.typing.DataFrameGroupBy.rolling#
- DataFrameGroupBy.rolling(window: int | Timedelta | timedelta64 | timedelta | str, min_periods=None, on: str | None = None, closed: Literal['right', 'left', 'both', 'neither'] = 'right') Window[source]#
Returns a rolling grouper, providing rolling functionality per group.
Examples:
>>> import bigframes.pandas as bpd >>> lst = ['a', 'a', 'a', 'a', 'e'] >>> ser = bpd.Series([1, 0, -2, -1, 2], index=lst) >>> ser.groupby(level=0).rolling(2).min() index index a a <NA> a 0 a -2 a -2 e e <NA> dtype: Int64
- Parameters:
window (int, pandas.Timedelta, numpy.timedelta64, datetime.timedelta, str) –
Size of the moving window.
If an integer, the fixed number of observations used for each window.
If a string, the timedelta representation in string. This string must be parsable by pandas.Timedelta().
Otherwise, the time range for each window.
min_periods (int, default None) –
Minimum number of observations in window required to have a value; otherwise, result is
np.nan.For a window that is specified by an integer,
min_periodswill default to the size of the window.For a window that is not spicified by an interger,
min_periodswill default to 1.on (str, optional) – For a DataFrame, a column label on which to calculate the rolling window, rather than the DataFrame’s index.
closed (str, default 'right') – If ‘right’, the first point in the window is excluded from calculations. If ‘left’, the last point in the window is excluded from calculations. If ‘both’, the no points in the window are excluded from calculations. If ‘neither’, the first and last points in the window are excluded from calculations.
- Returns:
Return a new grouper with our rolling appended.
- Return type: