Spec-Zone.ru › Nushell

polars is-in for expression

Creates an is-in expression or checks to see if the elements are contained in the right series

Signature

> polars is-in {flags} (list)

Parameters

  • list: List to check if values are in.

Input/output types:

input output
polars_expression polars_expression
polars_selector polars_expression

Examples

Creates a is-in expression using a list

> let df = ([[a b]; [one 1] [two 2] [three 3]] | polars into-df);
            $df | polars with-column (polars col a | polars is-in [one two] | polars as a_in)
╭───┬───────┬───┬───────╮
│ # │   a   │ b │ a_in  │
├───┼───────┼───┼───────┤
│ 0 │ one   │ 1 │ true  │
│ 1 │ two   │ 2 │ true  │
│ 2 │ three │ 3 │ false │
╰───┴───────┴───┴───────╯

Creates a is-in expression using a polars series

> let df = ([[a b]; [one 1] [two 2] [three 3]] | polars into-df);
            $df | polars with-column (polars col a | polars is-in ([one two] | polars into-df) | polars as a_in)
╭───┬───────┬───┬───────╮
│ # │   a   │ b │ a_in  │
├───┼───────┼───┼───────┤
│ 0 │ one   │ 1 │ true  │
│ 1 │ two   │ 2 │ true  │
│ 2 │ three │ 3 │ false │
╰───┴───────┴───┴───────╯

Creates a is-in expression using a polars expr

> let df = ([[a b]; [one 1] [two 2] [three 3]] | polars into-df);
            $df | polars with-column (polars col a | polars is-in (polars lit [one two] | polars implode) | polars as a_in)
╭───┬───────┬───┬───────╮
│ # │   a   │ b │ a_in  │
├───┼───────┼───┼───────┤
│ 0 │ one   │ 1 │ true  │
│ 1 │ two   │ 2 │ true  │
│ 2 │ three │ 3 │ false │
╰───┴───────┴───┴───────╯

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

Spec-Zone.ru

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