polars selector numeric

For expression.

Select all numeric columns.

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

Input/output types:

input output
any polars_selector

Examples

Select all numeric columns

> {
        "foo": ["x", "y"],
        "bar": [123, 456],
        "baz": [2.0, 5.5],
        "zap": [0, 0],
    } |
    polars into-df --as-columns |
    polars select (polars selector numeric) |
    polars sort-by bar baz zap |
    polars collect
╭───┬─────┬──────┬─────╮
│ # │ bar │ baz  │ zap │
├───┼─────┼──────┼─────┤
│ 0 │ 123 │ 2.00 │   0 │
│ 1 │ 456 │ 5.50 │   0 │
╰───┴─────┴──────┴─────╯

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