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

snowflake.snowpark.functions.desc_nulls_first

snowflake.snowpark.functions.desc_nulls_first(c: Union[Column, str]) Column[source]

Returns a Column expression with values sorted in descending order (null values sorted before non-null values).

Example:

>>> df = session.create_dataframe([1, 2, 3, None, None], schema=["a"])
>>> df.sort(desc_nulls_first(df["a"])).collect()
[Row(A=None), Row(A=None), Row(A=3), Row(A=2), Row(A=1)]
Copy