dfr group-by
for lazyframe> dfr group-by {flags} ...rest
...rest
: Expression(s) that define the lazy group-byinput | output |
---|---|
any | any |
Group by and perform an aggregation
> [[ab]; [12] [14] [26] [24]]
|dfr into-df
|dfr group-bya
|dfr agg [
(dfr colb|dfr min|dfr as"b_min")
(dfr colb|dfr max|dfr as"b_max")
(dfr colb|dfr sum|dfr as"b_sum")
]
╭───┬───┬───────┬───────┬───────╮
│# │ a │ b_min │ b_max │ b_sum │
├───┼───┼───────┼───────┼───────┤
│0│1│2│4│6│
│1│2│4│6│10│
╰───┴───┴───────┴───────┴───────╯
Group by and perform an aggregation
> [[ab]; [12] [14] [26] [24]]
|dfr into-lazy
|dfr group-bya
|dfr agg [
(dfr colb|dfr min|dfr as"b_min")
(dfr colb|dfr max|dfr as"b_max")
(dfr colb|dfr sum|dfr as"b_sum")
]
|dfr collect
╭───┬───┬───────┬───────┬───────╮
│# │ a │ b_min │ b_max │ b_sum │
├───┼───┼───────┼───────┼───────┤
│0│1│2│4│6│
│1│2│4│6│10│
╰───┴───┴───────┴───────┴───────╯
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_group-by.html