snowflake.snowpark.functions.corr¶
- snowflake.snowpark.functions.corr(column1: Union[Column, str], column2: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L660-L675)¶
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 | ---------------------