bach.DataFrame.rolling

rolling

(window, min_periods=None, center=False, closed='right')

[source]

A rolling window of size ‘window’, by default right aligned.

To use grouping as well, first call group_by() on this frame and call rolling on the result.

Parameters

  • window (int) – the window size.
  • min_periods (Optional[int]) – the min amount of rows included in the window before an actual value is returned.
  • center (bool) – center the result, or align the result on the right.
  • closed (str) – make the interval closed on the ‘right’, ‘left’, ‘both’ or ‘neither’ endpoints. Defaults to ‘right’, and the rest is currently unsupported.

Returns

a new DataFrame object with the group_by attribute set with a bach.partitioning.Window.

Return type

bach.dataframe.DataFrame

note

The win_type, axis and method parameters as supported by pandas, are currently not implemented.

note

The DataFrame is required to be sorted in order to avoid non-determinist results.

Raises

Exception – If DataFrame.order_by is empty.