polars selector string

For expression.

Select all string columns. Use `--include-categorical` to also select categorical columns.

warning This command requires a plugin The polars selector string 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 string {flags}

Flags

  • --include-categorical, -c: Also include categorical columns in the selection.

Input/output types:

input output
any polars_selector

Examples

Select all string columns

> {
    "name": ["Alice", "Bob"],
    "age": [30, 25],
    "active": [true, false],
} |
polars into-df --as-columns |
polars select (polars selector string) |
polars collect
╭───┬───────╮
│ # │ name  │
├───┼───────┤
│ 0 │ Alice │
│ 1 │ Bob   │
╰───┴───────╯

Create a selector for string and categorical columns

> polars selector string --include-categorical

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