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

snowflake.snowpark.functions.count¶

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

Returns either the number of non-NULL records for the specified columns, or the total number of records.

Example

>>> df = session.create_dataframe([[1], [None], [3], [4], [None]], schema=["a"])
>>> df.select(count(col("a")).alias("result")).show()
------------
|"RESULT"  |
------------
|3         |
------------

>>> df.select(count("*").alias("result")).show()
------------
|"RESULT"  |
------------
|5         |
------------
Copy