Skip to content

Aggregate the columns in the DataFrame to their mean value

Description

Aggregate the columns in the DataFrame to their mean value

Usage

<DataFrame>$mean()

Value

A polars DataFrame

Examples

library("polars")

df <- pl$DataFrame(a = 1:4, b = c(1, 2, 1, 1))
df$mean()
#> shape: (1, 2)
#> ┌─────┬──────┐
#> │ a   ┆ b    │
#> │ --- ┆ ---  │
#> │ f64 ┆ f64  │
#> ╞═════╪══════╡
#> │ 2.5 ┆ 1.25 │
#> └─────┴──────┘