Sample covariance

Supported in: Batch, Streaming

Calculate the sample covariance of values in two columns.

Expression categories: Aggregate

Declared arguments

  • Left - The first column on which we compute covariance.
    Expression<Numeric>
  • Right - The second column on which we compute covariance.
    Expression<Numeric>

Output type: Double

Examples

Example 1: Base case

Argument values:

  • Left: left
  • Right: right

Given input table:

leftright
15
24
33
42
51

Outputs: -2.5


Example 2: Null case

Argument values:

  • Left: left
  • Right: right

Given input table:

leftright
1.02.0
nullnull
2.01.0

Outputs: -0.5