Skip to content

Polars LazyFrame class (polars_lazy_frame)

Description

Representation of a Lazy computation graph/query against a DataFrame. This allows for whole-query optimisation in addition to parallelism, and is the preferred (and highest-performance) mode of operation for polars.

Usage

pl$LazyFrame(..., .schema_overrides = NULL, .strict = TRUE)

Arguments

\<dynamic-dots\> Name-value pairs of objects to be converted to polars Series by the as_polars_series() function. Each Series will be used as a column of the DataFrame. All values must be the same length or length 1. Each name will be used as the column name. If the name is empty, the original name of the Series will be used.
.schema_overrides [Experimental] A list of polars data types or NULL (default). Passed to the $cast() method as dynamic-dots.
.strict [Experimental] A logical value. Passed to the $cast() method’s .strict argument.

Details

The pl$LazyFrame(…) function is a shortcut for pl$DataFrame(…)$lazy().

Value

A polars LazyFrame

See Also

  • \$collect(): Materialize a LazyFrame into a DataFrame.

Examples

library("polars")

# Constructing a LazyFrame from vectors:
pl$LazyFrame(a = 1:2, b = 3:4)
#> <polars_lazy_frame at 0x55e33399dd98>
# Constructing a LazyFrame from Series:
pl$LazyFrame(pl$Series("a", 1:2), pl$Series("b", 3:4))
#> <polars_lazy_frame at 0x55e333b2fee8>
# Constructing a LazyFrame from a list:
data <- list(a = 1:2, b = 3:4)

# Using dynamic dots feature
pl$LazyFrame(!!!data)
#> <polars_lazy_frame at 0x55e333cf4a38>