maxframe.liteframe.groupby.LiteFrameGroupBy.rolling#
- LiteFrameGroupBy.rolling(window, min_periods=None, center=False, columns=None, order_by=None, order_by_ascending=True, window_shift=0)[source]#
Provide rolling-window calculations within each group.
The data is partitioned by the group key (hash shuffle) so that every group resides in a single partition; the rolling aggregation is then computed per-group. 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). Forcountthe value is the number of non-null observations, butmin_periodsstill 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 non-group-key columns are aggregated. Non-selected columns are passed through unchanged.
- Returns:
Intermediate object; call an aggregation method (e.g.
.sum()) to produce a LiteFrame.- Return type:
Notes
Warning
Grouped transforms hash-shuffle rows by group key, so the output row order follows reducer/hash-partition order and is not aligned with the input frame (unlike pandas, which preserves the index). Order restoration via a place-back operator (
LiteFrameIlocSetItem) is planned; seedocs/designs/liteframe/operators/window.md.Null-key rows are preserved with a null result (matching the other grouped transforms and the row-count-preserving transform contract); they are not grouped together. (This diverges from pandas grouped-rolling, which drops null-key rows under
dropna=True.)- Raises:
NotImplementedError – If
windowis not an integer.ValueError – If
windowis not positive ormin_periodsis invalid.