snowflake.snowpark.functions.regr_valy¶
- snowflake.snowpark.functions.regr_valy(y: Union[snowflake.snowpark.column.Column, str], x: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Returns the y value for each row where x is not None. If x is None, returns None. This function is used in linear regression calculations to get the dependent variable values for valid data points.
- Parameters:
y (ColumnOrName) – The dependent variable column or column name.
x (ColumnOrName) – The independent variable column or column name.
- Returns:
A column containing the y values where x is not None, None otherwise.
- Return type:
- Examples::
>>> from snowflake.snowpark.functions import col >>> df = session.create_dataframe([(2.0, 1.0), (None, 3.0), (6.0, None)], schema=["col_y", "col_x"]) >>> df.select(regr_valy(col("col_y"), col("col_x")).alias("result")).collect() [Row(RESULT=2.0), Row(RESULT=None), Row(RESULT=None)]