Skip to content

Compute the standard deviation of the sub-arrays

Description

Compute the standard deviation of the sub-arrays

Usage

<Expr>$arr$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(2, 1, 4), c(8.4, 3.2, 1)),
)$cast(pl$Array(pl$Float64, 3))
df$with_columns(std = pl$col("values")$arr$std())
#> shape: (2, 2)
#> ┌─────────────────┬──────────┐
#> │ values          ┆ std      │
#> │ ---             ┆ ---      │
#> │ array[f64, 3]   ┆ f64      │
#> ╞═════════════════╪══════════╡
#> │ [2.0, 1.0, 4.0] ┆ 1.527525 │
#> │ [8.4, 3.2, 1.0] ┆ 3.8      │
#> └─────────────────┴──────────┘