Spec-Zone.ru › Nushell

polars selector ends-with for expression

Select columns that end with the given substring(s).

Signature

> polars selector ends-with {flags} ...rest

Parameters

  • ...rest: Select columns that end with the given substring(s).

Input/output types:

input output
any polars_selector

Examples

Match columns ending with a 'z'

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

Match columns ending with either the letter 'z' or 'r'

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

Match columns ending with except the letter 'z'

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

Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/polars_selector_ends-with.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API