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

snowflake.snowpark.functions.nvl

snowflake.snowpark.functions.nvl(e1: Union[Column, str], e2: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.27.0/snowpark-python/src/snowflake/snowpark/functions.py#L10917-L10930)

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)]
Copy
语言: 中文