dfr sort-by
for lazyframe> dfr sort-by {flags} ...rest
--reverse, -r {list<bool>}
: Reverse sorting. Default is false--nulls-last, -n
: nulls are shown last in the dataframe--maintain-order, -m
: Maintains order during sort...rest
: sort expression for the dataframeinput | output |
---|---|
any | any |
Sort dataframe by one column
> [[ab]; [62] [14] [41]] |dfr into-df|dfr sort-bya
╭───┬───┬───╮
│# │ a │ b │
├───┼───┼───┤
│0│1│4│
│1│4│1│
│2│6│2│
╰───┴───┴───╯
Sort column using two columns
> [[ab]; [62] [11] [14] [24]] |dfr into-df|dfr sort-by [ab] -r [falsetrue]
╭───┬───┬───╮
│# │ a │ b │
├───┼───┼───┤
│0│1│4│
│1│1│1│
│2│2│4│
│3│6│2│
╰───┴───┴───╯
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_sort-by.html