W3cubDocs

/Nushell

dfr rolling for dataframe

Rolling calculation for a series.

Signature

> dfr rolling {flags} (type) (window)

Parameters

  • type: rolling operation
  • window: Window size for rolling

Input/output types:

input output
any any

Examples

Rolling sum for a series

> [12345] |dfr into-df|dfr rollingsum2|dfr drop-nulls
╭───┬───────────────╮
│# │ 0_rolling_sum │
├───┼───────────────┤
│0│3│
│1│5│
│2│7│
│3│9│
╰───┴───────────────╯

Rolling max for a series

> [12345] |dfr into-df|dfr rollingmax2|dfr drop-nulls
╭───┬───────────────╮
│# │ 0_rolling_max │
├───┼───────────────┤
│0│2│
│1│3│
│2│4│
│3│5│
╰───┴───────────────╯

Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_rolling.html