polars/polars-selector-coercion
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| Polars | info | unsafe, with xpd check --fix --unsafe-fixes |
Polars 2.0+ |
A selector combined with col by &, | or ^ becomes a value expression in Polars 2.1.0. Use selectors.by_name to combine column selections.
cs.numeric() | pl.col("x")cs.numeric() | cs.by_name("x")What the rule reports
Section titled “What the rule reports”Taking the union of numeric columns and a string column as a value expression raised SchemaError. Two selectors selected 3 columns.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to rewrite pl.col(...) with string column names to by_name(...) on the selector module.
Diagnostic message
Section titled “Diagnostic message”A selector combined with col by &, | or ^ becomes a value expression in Polars 2.1.0. Use selectors.by_name to combine column selections.See all rules in the Polars pack.