dfr sort-by
for lazyframe
Sorts a lazy dataframe based on expression(s).
WARNING
Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe
flag
Signature
> dfr sort-by {flags} ...rest
Flags
--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
Parameters
...rest
: sort expression for the dataframe
Input/output types:
input | output |
---|---|
any | any |
Examples
Sort dataframe by one column
> [[a b]; [6 2] [1 4] [4 1]] | dfr into-df | dfr sort-by a
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 4 │
│ 1 │ 4 │ 1 │
│ 2 │ 6 │ 2 │
╰───┴───┴───╯
Sort column using two columns
> [[a b]; [6 2] [1 1] [1 4] [2 4]] | dfr into-df | dfr sort-by [a b] -r [false true]
╭───┬───┬───╮
│ # │ a │ b │
├───┼───┼───┤
│ 0 │ 1 │ 4 │
│ 1 │ 1 │ 1 │
│ 2 │ 2 │ 4 │
│ 3 │ 6 │ 2 │
╰───┴───┴───╯