Groupby object¶
A conforming implementation of the dataframe API standard must provide and support a groupby object with the following API:
- class GroupBy(*args, **kwargs)¶
GroupBy object.
Note that this class is not meant to be constructed by users. It is returned from
DataFrame.group_by
.Methods
- __abstractmethods__ = frozenset({})¶
- __init__(*args, **kwargs)¶
- __parameters__ = ()¶
- __subclasshook__()¶
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- aggregate(*aggregation: Aggregation) DataFrame ¶
Aggregate columns according to given aggregation function.
Examples
>>> df: DataFrame >>> pdx = df.__dataframe_namespace__() >>> df.group_by('year').aggregate( ... pdx.Aggregation.sum('l_quantity').rename('sum_qty'), ... pdx.Aggregation.mean('l_quantity').rename('avg_qty'), ... pdx.Aggregation.mean('l_extended_price').rename('avg_price'), ... pdx.Aggregation.mean('l_discount').rename('avg_disc'), ... pdx.Aggregation.size().rename('count_order'), ... )