Skip to content

polars/polars-collect-then-lazy

Rule polars-collect-then-lazy
Pack Polars
Severity info
Fix unsafe, with xpd check --fix --unsafe-fixes
Library versions every version

Collect executes this query before lazy starts a new plan. Keep the operations in one plan when they can run together.

lf.collect().lazy()
lf

The collect call produced a DataFrame and lazy returned a new LazyFrame.

Use xpd check --fix --unsafe-fixes to drop .collect().lazy() when collect takes no arguments.

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

Collect executes this query before lazy starts a new plan. Keep the operations in one plan when they can run together.

Browse the other rules of the Polars pack.