datatable.corr()

Calculate the Pearson correlation between col1 and col2.

Parameters

col1
,
col2
Expr

Input columns.

return
Expr

f-expression having one row, one column and the correlation coefficient as the value. If one of the columns is non-numeric, the value is NA. The 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.corr(f.A, f.B)]
C0
float64
01

See Also

  • cov() – function to calculate covariance between two columns.