1.2.3 Lazy API
Eager verbs run immediately on a dataframe. The same verbs applied to a lazyframe (from lazy or scan-csv) build a query plan that collect optimises and runs. Here iris-csv is a path to a small CSV.
> (define df-small (~> (read-csv iris-csv) (filter (> (col "sepal_length") 5)))) > (~> df-small (group-by "species") (agg (mean "sepal_width")))
shape: (3, 2)
┌────────────┬─────────────┐
│ species ┆ sepal_width │
│ --- ┆ --- │
│ str ┆ f64 │
╞════════════╪═════════════╡
│ setosa ┆ 3.7 │
│ virginica ┆ 2.975 │
│ versicolor ┆ 2.95 │
└────────────┴─────────────┘
> (define q (~> (scan-csv iris-csv) (filter (> (col "sepal_length") 5)) (group-by "species") (agg (mean "sepal_width")))) > (collect q)
shape: (3, 2)
┌────────────┬─────────────┐
│ species ┆ sepal_width │
│ --- ┆ --- │
│ str ┆ f64 │
╞════════════╪═════════════╡
│ setosa ┆ 3.7 │
│ virginica ┆ 2.975 │
│ versicolor ┆ 2.95 │
└────────────┴─────────────┘
API gaps: no explain; no schema-only LazyFrame.