r/Python • u/KliNanban • Mar 08 '26
Discussion Polars vs pandas
I am trying to come from database development into python ecosystem.
Wondering if going into polars framework, instead of pandas will be any beneficial?
128
Upvotes
View all comments
Show parent comment
3
u/commandlineluser Mar 09 '26
When you use the DataFrame API:
Polars basically executes:
One idea being you should be able to easily convert your "eager" code by manually calling lazy / collect to run the "entire pipeline" as a single "query" instead:
(Or in the case of
read_*use the lazyscan_*equivalent which will return a LazyFrame directly))With manually calling
collect(), all optimizations are also enabled by default.This is one reason why writing "pandas style" (e.g.
df["foo"]) is discouraged in Polars, as it works on the in-memory Series objects and cannot be lazy.The User Guide explains things in detail: