snowflake.snowpark.GroupingSets¶
- class snowflake.snowpark.GroupingSets(*sets: Union[Column, List[Column]])[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/relational_grouped_dataframe.py#L93-L117)¶
Bases:
object
Creates a
GroupingSets
object from a list of column/expression sets that you pass toDataFrame.group_by_grouping_sets()
. SeeDataFrame.group_by_grouping_sets()
for examples of how to use this class with aDataFrame
. See GROUP BY GROUPING SETS for its counterpart in SQL (several examples are shown below).Python interface
SQL interface
GroupingSets([col("a")], [col("b")])
GROUPING SETS ((a), (b))
GroupingSets([col("a") , col("b")], [col("c"), col("d")])
GROUPING SETS ((a, b), (c, d))
GroupingSets([col("a"), col("b")])
GROUPING SETS ((a, b))
GroupingSets(col("a"), col("b"))
GROUPING SETS ((a, b))