daft.DataFrame.agg#

DataFrame.agg(to_agg: list[tuple[Union[daft.expressions.Expression, str], str]]) daft.dataframe.dataframe.DataFrame[source]#

Perform aggregations on this DataFrame. Allows for mixed aggregations for multiple columns Will return a single row that aggregated the entire DataFrame.

Example

>>> df = df.agg([
>>>     ('x', 'sum'),
>>>     ('x', 'mean'),
>>>     ('y', 'min'),
>>>     ('y', 'max'),
>>>     (col('x') + col('y'), 'max'),
>>> ])
Parameters

to_agg (List[Tuple[ColumnInputType, str]]) – list of (column, agg_type)

Returns

DataFrame with aggregated results

Return type

DataFrame