Skip to content

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")

Taking the union of numeric columns and a string column as a value expression raised SchemaError. Two selectors selected 3 columns.

Use xpd check --fix --unsafe-fixes to rewrite pl.col(...) with string column names to by_name(...) on the selector module.

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.