polars.DataFrame.lazy

DataFrame.lazy() polars.internals.lazy_frame.LazyFrame[polars.internals.frame.DF]

Start a lazy query from this point. This returns a LazyFrame object.

Operations on a LazyFrame are not executed until this is requested by either calling:

  • .fetch() (run on a small number of rows)

  • .collect() (run on all data)

  • .describe_plan() (print unoptimized query plan)

  • .describe_optimized_plan() (print optimized query plan)

  • .show_graph() (show (un)optimized query plan) as graphiz graph)

Lazy operations are advised because they allow for query optimization and more parallelization.