snowflake.snowpark.functions.avg¶
- snowflake.snowpark.functions.avg(e: Union[Column, str]) Column [source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/functions.py#L642-L657)¶
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 | ------------