bigframes.pandas.DataFrame.rolling#

DataFrame.rolling(window:int|Timedelta|timedelta64|timedelta|str,min_periods=None,on:str|None=None,closed:Literal['right','left','both','neither']='right')Window[source]#

Provide rolling window calculations.

Examples:

>>>importbigframes.pandasasbpd>>>s=bpd.Series([0,1,2,3,4])>>>s.rolling(window=3).min()0    <NA>1    <NA>2       03       14       2dtype: Int64
>>>df=bpd.DataFrame({'A':[0,1,2,3],'B':[0,2,4,6]})>>>df.rolling(window=2,on='A',closed='both').sum()A     B0  0  <NA>1  1     22  2     63  3    12[4 rows x 2 columns]
Parameters:
  • window (int,pandas.Timedelta,numpy.timedelta64,datetime.timedelta,str) –

    Size of the moving window.

    If an integer, the fixed number of observations used foreach window.

    If a string, the timedelta representation in string. This stringmust 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 isnp.nan.

    For a window that is specified by an integer,min_periods will defaultto the size of the window.

    For a window that is not spicified by an interger,min_periods will defaultto 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:

Window subclass if awin_type is passed.

Rolling subclass ifwin_type is not passed.

Return type:

bigframes.core.window.Window

On this page

This Page