polars selector exclude

For expression.

Select all columns except those with the given name(s). This is the inverse of `polars selector by-name`.

warning This command requires a plugin The polars selector exclude command resides in the polars plugin. To use this command, you must install and register nu_plugin_polars. See the Plugins chapter in the book for more information.

Command Type

plugin

Signature

> polars selector exclude {flags} ...rest

Parameters

  • ...rest: Column name(s) to exclude from the selection.

Input/output types:

input output
any polars_selector

Examples

Select all columns except ‘a’ and ‘b’

> {
    "a": [1.0, 2.0],
    "b": [3.0, 4.0],
    "c": [5, 6],
} |
polars into-df --as-columns |
polars select (polars selector exclude a b) |
polars collect
╭───┬───╮
│ # │ c │
├───┼───┤
│ 0 │ 5 │
│ 1 │ 6 │
╰───┴───╯

Select all columns except ‘c’

> [[a b c]; [1 2 3] [4 5 6]]
    | polars into-df
    | polars select (polars selector exclude c)
    | polars collect

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.