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:

inputoutput
anyany

Examples

Creates a is-in expression

> 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
╰───┴───────┴───┴───────╯

Checks if elements from a series are contained in right series

> let other = ([1 3 6] | polars into-df);
            [5 6 6 6 8 8 8] | polars into-df | polars is-in $other
╭───┬───────╮
 # │ is_in │
├───┼───────┤
 0 false
 1 true
 2 true
 3 true
 4 false
 5 false
 6 false
╰───┴───────╯