Shift the values by a given period
Description
Shift the values by a given period
Usage
<GroupBy>$shift(n = 1, fill_value = NULL)
Arguments
n
|
Number of indices to shift forward. If a negative value is passed, values are shifted in the opposite direction instead. |
fill_value
|
Fill the resulting null values with this value. Accepts expression input. Non-expression inputs are parsed as literals. |
Value
GroupBy
Examples
#> shape: (3, 11)
#> ┌─────┬────────────┬────────────┬────────────┬───┬────────────┬────────────┬───────────┬───────────┐
#> │ cyl ┆ mpg ┆ disp ┆ hp ┆ … ┆ vs ┆ am ┆ gear ┆ carb │
#> │ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │
#> │ f64 ┆ list[f64] ┆ list[f64] ┆ list[f64] ┆ ┆ list[f64] ┆ list[f64] ┆ list[f64] ┆ list[f64] │
#> ╞═════╪════════════╪════════════╪════════════╪═══╪════════════╪════════════╪═══════════╪═══════════╡
#> │ 6.0 ┆ [null, ┆ [null, ┆ [null, ┆ … ┆ [null, ┆ [null, ┆ [null, ┆ [null, │
#> │ ┆ null, … ┆ null, … ┆ null, … ┆ ┆ null, … ┆ null, … ┆ null, … ┆ null, … │
#> │ ┆ 19.2] ┆ 167.6] ┆ 123.0] ┆ ┆ 1.0] ┆ 0.0] ┆ 4.0] ┆ 4.0] │
#> │ 8.0 ┆ [null, ┆ [null, ┆ [null, ┆ … ┆ [null, ┆ [null, ┆ [null, ┆ [null, │
#> │ ┆ null, … ┆ null, … ┆ null, … ┆ ┆ null, … ┆ null, … ┆ null, … ┆ null, … │
#> │ ┆ 19.2] ┆ 400.0] ┆ 175.0] ┆ ┆ 0.0] ┆ 0.0] ┆ 3.0] ┆ 2.0] │
#> │ 4.0 ┆ [null, ┆ [null, ┆ [null, ┆ … ┆ [null, ┆ [null, ┆ [null, ┆ [null, │
#> │ ┆ null, … ┆ null, … ┆ null, … ┆ ┆ null, … ┆ null, … ┆ null, … ┆ null, … │
#> │ ┆ 26.0] ┆ 120.3] ┆ 91.0] ┆ ┆ 0.0] ┆ 1.0] ┆ 5.0] ┆ 2.0] │
#> └─────┴────────────┴────────────┴────────────┴───┴────────────┴────────────┴───────────┴───────────┘