eland.groupby.DataFrameGroupBy.agg

DataFrameGroupBy.agg(func: Union[str, List[str]], numeric_only: Optional[bool] = False) → pd.DataFrame

Used to groupby and aggregate

Parameters
func:

Functions to use for aggregating the data.

Accepted combinations are: - function - list of functions

numeric_only: {True, False, None} Default is None

Which datatype to be returned - True: returns all values with float64, NaN/NaT are ignored. - False: returns all values with float64. - None: returns all values with default datatype.

Returns
pandas.DataFrame

aggregation value for each numeric column of each group

Examples

>>> df = ed.DataFrame(
...   "localhost", "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "DestCountry"]
... )
>>> df.groupby("DestCountry").aggregate(["min", "max"]) # doctest: +NORMALIZE_WHITESPACE
            AvgTicketPrice               ... dayOfWeek
                       min          max  ...       min max
DestCountry                              ...
AE              110.799911  1126.148682  ...         0   6
AR              125.589394  1199.642822  ...         0   6
AT              100.020531  1181.835815  ...         0   6
AU              102.294312  1197.632690  ...         0   6
CA              100.557251  1198.852539  ...         0   6
...                    ...          ...  ...       ...  ..
RU              101.004005  1196.742310  ...         0   6
SE              102.877190  1198.621582  ...         0   6
TR              142.876465   855.935547  ...         0   6
US              100.145966  1199.729004  ...         0   6
ZA              102.002663  1196.186157  ...         0   6
<BLANKLINE>
[32 rows x 6 columns]