dataFrame.column.stat — variance()

Description

The variance() method of the stat object returns the variance of the values in the selected column.

Signature

dataFrame.column(columnName).stat.variance({ estimator: 'sample' })
Scope
column
Family
stat
Returns
number

Argument

columnName (string)
The name of the column from which to compute the variance.
options (object)
Variance calculation options.

Option

estimator (string)
The estimator used to compute variance.
  • binary
  • population
  • sample (default)

Returns

variance (number)
The variance of the values in the selected column.

Notes

  • The population estimator computes the population variance.
  • The sample estimator applies Bessel's correction and computes the sample variance.
  • The binary estimator computes the variance of a binary variable.

Example

// get the variance of the values of a column of the dataFrame
var variance = dataFrame.column('revenue').stat.variance();

// log the variance
notebook.log(variance);