snowflake.snowpark.functions.sum

snowflake.snowpark.functions.sum(e: Union[Column, str]) Column[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/functions.py#L1168-L1183)

Returns the sum of non-NULL records in a group. You can use the DISTINCT keyword to compute the sum of unique non-null values. If all records inside a group are NULL, the function returns NULL.

Example::
>>> df = session.create_dataframe(
...     [4, 9],
...     schema=["N"],
... ).select(sum(col("N")))
>>> df.collect()
[Row(SUM("N")=13)]
Copy
Language: English