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' })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.
binarypopulationsample(default)
Returns
variance(number)- The variance of the values in the selected column.
Notes
- The
populationestimator computes the population variance. - The
sampleestimator applies Bessel's correction and computes the sample variance. - The
binaryestimator 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);