snowflake.snowpark.functions.ifnull¶
- snowflake.snowpark.functions.ifnull(e1: Union[Column, str], e2: Union[Column, str]) Column [source]¶
If expr1 is NULL, returns expr2, otherwise returns expr1.
Example:
>>> df = session.create_dataframe([("a", "b"), ("c", None), (None, "d"), (None, None)], schema=["e1", "e2"]) >>> df.select(ifnull(df["e1"], df["e2"]).alias("result")).collect() [Row(RESULT='a'), Row(RESULT='c'), Row(RESULT='d'), Row(RESULT=None)]