math variance for math
Returns the variance of a list of numbers or of each column in a table.
Signature
> math variance {flags}
Flags
-
--sample, -s: Calculate sample variance (i.e. using N-1 as the denominator).
Input/output types:
| input | output |
|---|---|
| list<number> | number |
| range | number |
| table | record |
| record | record |
Examples
Get the variance of a list of numbers.
> [1 2 3 4 5] | math variance 2.0
Get the sample variance of a list of numbers.
> [1 2 3 4 5] | math variance --sample 2.5
Compute the variance of each column in a table.
> [[a b]; [1 2] [3 4]] | math variance ╭───┬───╮ │ a │ 1 │ │ b │ 1 │ ╰───┴───╯
Copyright © 2019–2026 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/math_variance.html