dfr filter-with for dataframe or lazyframe

Filters dataframe using a mask or expression as reference.

WARNING

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

Signature

> dfr filter-with {flags} (mask or expression)

Parameters

  • mask or expression: boolean mask used to filter data

Input/output types:

inputoutput
anyany

Examples

Filter dataframe using a bool mask

> let mask = ([true false] | dfr into-df);
    [[a b]; [1 2] [3 4]] | dfr into-df | dfr filter-with $mask
╭───┬───┬───╮
 # │ a │ b │
├───┼───┼───┤
 0  1  2 
╰───┴───┴───╯

Filter dataframe using an expression

> [[a b]; [1 2] [3 4]] | dfr into-df | dfr filter-with ((dfr col a) > 1)
╭───┬───┬───╮
 # │ a │ b │
├───┼───┼───┤
 0  3  4 
╰───┴───┴───╯