Spec-Zone.ru › Nushell

polars str-strip-chars для dataframe

Удаляет указанные символы из строк в столбце

Сигнатура

> polars str-strip-chars {flags} (pattern)

Флаги

  • --start, -s: Удалять символы только в начале строк.
  • --end, -e: Удалять символы только в конце строк.

Параметры

  • pattern: Символы для удаления в виде строки или выражения polars.

Типы входных и выходных данных:

входные данные выходные данные
polars_expression polars_expression
polars_selector polars_expression

Примеры

Удаление символов с обоих концов строк в столбце

> [[text]; ["!!!hello!!!"] ["!!!world!!!"] ["!!!test!!!"]] | polars into-df | polars select (polars col text | polars str-strip-chars "!") | polars collect
╭───┬───────╮
│ # │ text  │
├───┼───────┤
│ 0 │ hello │
│ 1 │ world │
│ 2 │ test  │
╰───┴───────╯

Удаление символов с обоих концов строк в столбце с помощью выражения

> [[text]; ["!!!hello!!!"] ["!!!world!!!"] ["!!!test!!!"]] | polars into-df | polars select (polars col text | polars str-strip-chars (polars lit "!")) | polars collect
╭───┬───────╮
│ # │ text  │
├───┼───────┤
│ 0 │ hello │
│ 1 │ world │
│ 2 │ test  │
╰───┴───────╯

Удаление символов в конце строк в столбце

> [[text]; ["hello!!!"] ["world!!!"] ["test!!!"]] | polars into-df | polars select (polars col text | polars str-strip-chars --end "!") | polars collect
╭───┬───────╮
│ # │ text  │
├───┼───────┤
│ 0 │ hello │
│ 1 │ world │
│ 2 │ test  │
╰───┴───────╯

Удаление символов в начале строк в столбце

> [[text]; ["!!!hello"] ["!!!world"] ["!!!test"]] | polars into-df | polars select (polars col text | polars str-strip-chars --start "!") | polars collect
╭───┬───────╮
│ # │ text  │
├───┼───────┤
│ 0 │ hello │
│ 1 │ world │
│ 2 │ test  │
╰───┴───────╯

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

Spec-Zone.ru

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