Helpers¶
Various helper functions for working with Polars.
- oi_tools.polars_helpers.to_expr(
- x: str | Expr | int | float,
Convert the input to a Polars expression.
- Parameters:
x (str | Expr | int | float) – A Polars expression, column name string, or numeric literal.
- Returns:
A Polars expression.
- Return type:
pl.Expr
- oi_tools.polars_helpers.to_masked_expr(
- *xs: str | Expr | int | float,
Create a set of expressions with a standardized null mask.
All output expressions evaluate to null wherever any input expression is null.
- Parameters:
*xs (str | Expr | int | float) – Expressions to mask.
- Returns:
Expressions that evaluate to null when any input is null.
- Return type:
Sequence[pl.Expr]
- oi_tools.polars_helpers.to_selector(
- x: Collection[str] | Selector,
Convert the input to a Polars selector.
- Parameters:
x (Collection[str] | Selector) – A Polars selector or a collection of column names.
- Returns:
A Polars column selector.
- Return type:
cs.Selector