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

snowflake.snowpark.functions.avg¶

snowflake.snowpark.functions.avg(e: Union[Column, str]) → Column[source]¶

Returns the average of non-NULL records. If all records inside a group are NULL, the function returns NULL.

Example::
>>> df = session.create_dataframe([[1], [2], [2]], schema=["d"])
>>> df.select(avg(df.d).alias("result")).show()
------------
|"RESULT"  |
------------
|1.666667  |
------------
Copy