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

snowflake.snowpark.RelationalGroupedDataFrame

class snowflake.snowpark.RelationalGroupedDataFrame(df: DataFrame, grouping_exprs: List[Expression], group_type: _GroupType)[source]

Bases: object

Represents an underlying DataFrame with rows that are grouped by common values. Can be used to define aggregations on these grouped DataFrames.

Methods

agg(*exprs)

Returns a DataFrame with computed aggregates.

applyInPandas(func, output_schema, **kwargs)

Maps each grouped dataframe in to a pandas.DataFrame, applies the given function on data of each grouped dataframe, and returns a pandas.DataFrame.

apply_in_pandas(func, output_schema, **kwargs)

Maps each grouped dataframe in to a pandas.DataFrame, applies the given function on data of each grouped dataframe, and returns a pandas.DataFrame.

avg(*cols)

Return the average for the specified numeric columns.

builtin(agg_name)

Computes the builtin aggregate agg_name over the specified columns.

count()

Return the number of rows for each group.

function(agg_name)

Computes the builtin aggregate agg_name over the specified columns.

max(*cols)

Return the max for the specified numeric columns.

mean(*cols)

Return the average for the specified numeric columns.

median(*cols)

Return the median for the specified numeric columns.

min(*cols)

Return the min for the specified numeric columns.

pivot(pivot_col[, values, default_on_null])

Rotates this DataFrame by turning unique values from one column in the input expression into multiple columns and aggregating results where required on any remaining column values.

sum(*cols)

Return the sum for the specified numeric columns.