What kind of polars expression (pl.Expr
) might be used in a filter context that will match anything including nulls?
Use case: Type hinting and helper Functions that should return an polars.Expr
.
The expression representing the literal value True
might be used. See pl.lit
for more details.
Example.
import polars as pl
df = pl.DataFrame({
"a": [1, 2, None]
})
df.filter(pl.lit(True))
shape: (3, 1)
┌──────┐
│ a │
│ --- │
│ i64 │
╞══════╡
│ 1 │
│ 2 │
│ null │
└──────┘
Note. In general, simply True
also works, but its not an instance of pl.Expr
.