Skip to content

polars/polars-collect-in-loop

Pack Severity Fix Versions
Polars info none, edit by hand All versions

Collect inside a loop can execute a separate query on each iteration. Build the queries first and use collect_all when they are independent.

lf.collect()
pl.collect_all([lf] * 3)

Three collect calls produced the same three frames as collect_all in the probe.

Edit the code using the replacement in the example.

Collect inside a loop can execute a separate query on each iteration. Build the queries first and use collect_all when they are independent.

See all rules in the Polars pack.