polars.Series.shift#
- Series.shift(periods: int = 1) Series [source]#
Shift the values by a given period.
- Parameters:
- periods
Number of places to shift (may be negative).
Examples
>>> s = pl.Series("a", [1, 2, 3]) >>> s.shift(periods=1) shape: (3,) Series: 'a' [i64] [ null 1 2 ] >>> s.shift(periods=-1) shape: (3,) Series: 'a' [i64] [ 2 3 null ]