maxframe.liteframe.LiteFrame.rolling#

LiteFrame.rolling(window, min_periods=None, center=False, columns=None, order_by=None, order_by_ascending=True, window_shift=0)#

Provide rolling-window calculations.

Returns a LiteFrameRolling object whose aggregation methods (.sum(), .mean(), …) compute a fixed-size moving window aggregation. Only integer window sizes are supported.

Parameters:
  • window (int) – Size of the moving window (number of rows). Must be positive.

  • min_periods (int or None, default None) – Minimum number of observations in a window required to produce a value (otherwise null). Defaults to window (matching pandas). For count the value is the number of non-null observations, but min_periods still gates on the number of window rows (observations), not the non-null count — consistent with pandas.

  • center (bool, default False) – Center the window on the current row.

  • columns (str, list of str, or None, default None) – Column(s) to aggregate. If None, all columns are aggregated. Non-selected columns are passed through unchanged.

  • order_by (str, list of str, or None, default None) – Column(s) that define the order in which the window expands (equivalent to ORDER BY inside a MaxCompute OVER() clause). The output row order is unchanged; each row receives the aggregation computed over the rows that precede it in order_by order.

  • order_by_ascending (bool or list of bool, default True) – Sort direction for each order_by column. A single bool is broadcast to all columns.

  • window_shift (int, default 0) – Offset the window frame by N rows. A positive value shifts the window forward (toward later rows), a negative value backward. Matches the MaxCompute shift MF-specific window parameter.

Returns:

Intermediate object; call an aggregation method to produce a LiteFrame.

Return type:

LiteFrameRolling

Raises:
  • NotImplementedError – If window is not an integer (offset/time windows unsupported), or if MF-specific fields (order_by/window_shift) are used with grouped or multi-chunk inputs.

  • ValueError – If window is not positive or min_periods is invalid.

See also

expanding

Provide expanding window calculations.

shift

Shift rows by a given number of periods.