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()lfWhat the rule reports
Section titled “What the rule reports”The collect call produced a DataFrame and lazy returned a new LazyFrame.
How to fix it
Section titled “How to fix it”Use xpd check --fix --unsafe-fixes to drop .collect().lazy() when collect takes no arguments.
Message
Section titled “Message”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.