dfr sort-by
for lazyframe
sorts a lazy dataframe based on expression(s).
Signature
> dfr sort-by ...rest --reverse --nulls-last --maintain-order
Parameters
...rest
: sort expression for the dataframe--reverse {list<bool>}
: Reverse sorting. Default is false--nulls-last
(-n)
: nulls are shown last in the dataframe--maintain-order
(-m)
: Maintains order during sort
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 │
╰───┴───┴───╯
Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe
flag