maxframe.liteframe.groupby.LiteFrameGroupBy.shift#

LiteFrameGroupBy.shift(periods=1, fill_value=None, columns=None)[source]#

Shift rows within each group by periods positions.

Parameters:
  • periods (int, default 1) – Number of positions to shift within each group.

  • fill_value (scalar, default None) – Value to fill positions introduced by shifting.

  • columns (str, list of str, or None, default None) – Column(s) to shift. If None, all non-group-key columns are shifted.

Returns:

Shifted LiteFrame with the same shape (row count preserved). Output dtypes follow the same rules as standalone shift: they depend on the input dtype and fill_value (columns may be widened when a non-null fill_value is supplied).

Return type:

LiteFrame

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). Row count is preserved. Order restoration via a place-back operator (LiteFrameIlocSetItem) is planned; see docs/designs/liteframe/operators/window.md.

Null-key rows are preserved with a null result (matching pandas groupby.shift() under the default dropna=True); they are not grouped together.