Skip to content

Compute the standard deviation in every sub-list

Description

Compute the standard deviation in every sub-list

Usage

<Expr>$list$std(ddof = 1)

Arguments

ddof "Delta Degrees of Freedom": the divisor used in the calculation is N - ddof, where N represents the number of elements. By default ddof is 1.

Value

A polars expression

Examples

library("polars")

df <- pl$DataFrame(values = list(c(-1, 0, 1), c(1, 10)))

df$with_columns(
  std = pl$col("values")$list$std()
)
#> shape: (2, 2)
#> ┌──────────────────┬──────────┐
#> │ values           ┆ std      │
#> │ ---              ┆ ---      │
#> │ list[f64]        ┆ f64      │
#> ╞══════════════════╪══════════╡
#> │ [-1.0, 0.0, 1.0] ┆ 1.0      │
#> │ [1.0, 10.0]      ┆ 6.363961 │
#> └──────────────────┴──────────┘