math stddev

For math.

Returns the standard deviation of a list of numbers, or of each column in a table.

Command Type

built-in

Signature

> math stddev {flags} ...rest

Flags

  • --sample, -s: Calculate sample standard deviation (i.e. using N-1 as the denominator).

Parameters

  • ...rest: The cell-paths/columns to operate on.

Input/output types:

input output
list<number> number
list<duration> duration
list<filesize> filesize
range number
table record
record record

Examples

Compute the standard deviation of a list of numbers.

> [1 2 3 4 5] | math stddev
1.4142135623730951

Compute the sample standard deviation of a list of numbers.

> [1 2 3 4 5] | math stddev --sample
1.5811388300841898

Compute the standard deviation of each column in a table.

> [[a b]; [1 2] [3 4]] | math stddev
╭───┬──────╮
│ a │ 1.00 │
│ b │ 1.00 │
╰───┴──────╯

Compute the standard deviation of list-valued columns in a record.

> {alice: [1 3], bob: [4 6]} | math stddev
╭───────┬──────╮
│ alice │ 1.00 │
│ bob   │ 1.00 │
╰───────┴──────╯

Compute the standard deviation of a single column using a cell path.

> {alice: [1 3], bob: [4 6]} | math stddev alice
╭───────┬───────────╮
│ alice │ 1.00      │
│       │ ╭───┬───╮ │
│ bob   │ │ 0 │ 4 │ │
│       │ │ 1 │ 6 │ │
│       │ ╰───┴───╯ │
╰───────┴───────────╯

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.