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

snowflake.snowpark.functions.mode

snowflake.snowpark.functions.mode(e: Union[Column, str]) Column[source]

Returns the most frequent value for the records in a group. NULL values are ignored. If all the values are NULL, or there are 0 rows, then the function returns NULL.

Example:

>>> df = session.create_dataframe([1, 3, 10, 1, 4], schema=["x"])
>>> df.select(mode("x").as_("x")).collect()
[Row(X=1)]
Copy