Skip to content

Sum

Source code

Description

Aggregate the columns of this LazyFrame to their sum values.

Usage

<LazyFrame>$sum()

Value

A LazyFrame with one row

Examples

library(polars)

pl$LazyFrame(mtcars)$sum()$collect()
#> shape: (1, 11)
#> ┌───────┬───────┬────────┬────────┬───┬──────┬──────┬───────┬──────┐
#> │ mpg   ┆ cyl   ┆ disp   ┆ hp     ┆ … ┆ vs   ┆ am   ┆ gear  ┆ carb │
#> │ ---   ┆ ---   ┆ ---    ┆ ---    ┆   ┆ ---  ┆ ---  ┆ ---   ┆ ---  │
#> │ f64   ┆ f64   ┆ f64    ┆ f64    ┆   ┆ f64  ┆ f64  ┆ f64   ┆ f64  │
#> ╞═══════╪═══════╪════════╪════════╪═══╪══════╪══════╪═══════╪══════╡
#> │ 642.9 ┆ 198.0 ┆ 7383.1 ┆ 4694.0 ┆ … ┆ 14.0 ┆ 13.0 ┆ 118.0 ┆ 90.0 │
#> └───────┴───────┴────────┴────────┴───┴──────┴──────┴───────┴──────┘