You are viewing documentation about an older version (1.3.0). View latest version

snowflake.snowpark.functions.corr¶

snowflake.snowpark.functions.corr(column1: ColumnOrName, column2: ColumnOrName) → Column[source]¶

Returns the correlation coefficient for non-null pairs in a group.

Example

>>> df = session.create_dataframe([[1, 2], [1, 2], [4, 5], [2, 3], [3, None], [4, None], [6,4]], schema=["a", "b"])
>>> df.select(corr(col("a"), col("b")).alias("result")).show()
---------------------
|"RESULT"           |
---------------------
|0.813681508328809  |
---------------------
Copy