How can I define a literal array in a Polars expression? For example, if I wanted to filter if an expression was true and a given value in a mask was true.
import polars as pl
df = pl.DataFrame(dict(x=[1,2,3,4,5,6]))
mask = [True, True, False, False, True, True]
df.filter(pl.col('x') % 2 == 0 & pl.lit(mask))
# could not convert value [True, True, False, False, True, True] as a Literal
For this particular example, I could use []
indexing on the data frame and then do the filter, but for more complicated expressions, it would be easier if I could insert the array into the expression.