Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

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:

inputoutput
list<number>number
rangenumber
tablerecord
recordrecord

Examples

Get the variance of a list of numbers

> [1 2 3 4 5] | math variance
2

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 │
╰───┴───╯