snowflake.snowpark.DataFrame.cov¶
- DataFrame.cov(col1: Union[Column, str], col2: Union[Column, str], *, statement_params: Optional[Dict[str, str]] = None) Optional[float][source] (https://github.com/snowflakedb/snowpark-python/blob/v1.30.0/snowpark-python/src/snowflake/snowpark/dataframe_stat_functions.py#L237-L292)¶
- Calculates the sample covariance for non-null pairs in two numeric columns. - Example: - >>> df = session.create_dataframe([[0.1, 0.5], [0.2, 0.6], [0.3, 0.7]], schema=["a", "b"]) >>> df.stat.cov("a", "b") 0.010000000000000037 - Parameters:
- col1 – The name of the first numeric column to use. 
- col2 – The name of the second numeric column to use. 
- statement_params – Dictionary of statement level parameters to be set while executing this action. 
 
- Returns:
- The sample covariance of the two numeric columns. If there is not enough data to generate the covariance, the method returns None.