datatable.cov()

Calculate covariance between col1 and col2.

Parameters

col1
,
col2
Expr

Input columns.

return
Expr

f-expression having one row, one column and the covariance between col1 and col2 as the value. If one of the input columns is non-numeric, the value is NA. The output column stype is float32 if both col1 and col2 are float32, and float64 in all the other cases.

Examples

from datatable import dt, f DT = dt.Frame(A = [0, 1, 2, 3], B = [0, 2, 4, 6]) DT
AB
int32int32
000
112
224
336
DT[:, dt.cov(f.A, f.B)]
C0
float64
03.33333

See Also

  • corr() – function to calculate correlation between two columns.