Skip to content

polars/polars-sequential-with-columns

Pack Severity Fix Versions
Polars info unsafe, with xpd check --fix --unsafe-fixes All versions

Chained with_columns calls may split work into separate steps. Combine independent expressions and keep later calls for expressions that use newly created columns.

df.with_columns(a=expr + 1).with_columns(b=expr + 2)
df.with_columns(a=expr + 1, b=expr + 2)

Independent expressions gave equal frames.

Use xpd check --fix --unsafe-fixes to combine chained with_columns calls when the second call does not depend on columns created in the first.

Chained with_columns calls may split work into separate steps. Combine independent expressions and keep later calls for expressions that use newly created columns.

See all rules in the Polars pack.