snowflake.snowpark.GroupingSets¶
- class snowflake.snowpark.GroupingSets(*sets: Column | List[Column])[source]¶
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))