Skip to content

Var

Source code

Description

Aggregate the columns of this LazyFrame to their variance values.

Usage

<LazyFrame>$var(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 LazyFrame with one row

Examples

library("polars")

as_polars_lf(mtcars)$var()$collect()
#> shape: (1, 11)
#> ┌───────────┬──────────┬─────────────┬─────────────┬───┬──────────┬──────────┬──────────┬──────────┐
#> │ mpg       ┆ cyl      ┆ disp        ┆ hp          ┆ … ┆ vs       ┆ am       ┆ gear     ┆ carb     │
#> │ ---       ┆ ---      ┆ ---         ┆ ---         ┆   ┆ ---      ┆ ---      ┆ ---      ┆ ---      │
#> │ f64       ┆ f64      ┆ f64         ┆ f64         ┆   ┆ f64      ┆ f64      ┆ f64      ┆ f64      │
#> ╞═══════════╪══════════╪═════════════╪═════════════╪═══╪══════════╪══════════╪══════════╪══════════╡
#> │ 36.324103 ┆ 3.189516 ┆ 15360.79982 ┆ 4700.866935 ┆ … ┆ 0.254032 ┆ 0.248992 ┆ 0.544355 ┆ 2.608871 │
#> │           ┆          ┆ 9           ┆             ┆   ┆          ┆          ┆          ┆          │
#> └───────────┴──────────┴─────────────┴─────────────┴───┴──────────┴──────────┴──────────┴──────────┘