Skip to content

Get mean value

Description

Get mean value

Usage

<Expr>$mean()

Value

A polars expression

Examples

library("polars")

pl$DataFrame(x = c(1, 3, 4, NA))$
  with_columns(mean = pl$col("x")$mean())
#> shape: (4, 2)
#> ┌──────┬──────────┐
#> │ x    ┆ mean     │
#> │ ---  ┆ ---      │
#> │ f64  ┆ f64      │
#> ╞══════╪══════════╡
#> │ 1.0  ┆ 2.666667 │
#> │ 3.0  ┆ 2.666667 │
#> │ 4.0  ┆ 2.666667 │
#> │ null ┆ 2.666667 │
#> └──────┴──────────┘