W3cubDocs

/Nushell

dfr filter-with for dataframe or lazyframe

Filters dataframe using a mask or expression as reference.

Signature

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

Parameters

  • mask or expression: boolean mask used to filter data

Input/output types:

input output
any any

Examples

Filter dataframe using a bool mask

>letmask= ([truefalse] |dfr into-df);
    [[ab]; [12] [34]] |dfr into-df|dfr filter-with$mask
╭───┬───┬───╮
# │ a │ b │
├───┼───┼───┤
012
╰───┴───┴───╯

Filter dataframe using an expression

> [[ab]; [12] [34]] |dfr into-df|dfr filter-with ((dfr cola) >1)
╭───┬───┬───╮
# │ a │ b │
├───┼───┼───┤
034
╰───┴───┴───╯

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_filter-with.html