eland.DataFrame.agg

DataFrame.agg(func, axis=0, *args, **kwargs)

Aggregate using one or more operations over the specified axis.

Parameters
func: function, str, list or dict

Function to use for aggregating the data. If a function, must either work when passed a %(klass)s or when passed to %(klass)s.apply.

Accepted combinations are:

  • function

  • string function name

  • list of functions and/or function names, e.g. [np.sum, 'mean']

  • dict of axis labels -> functions, function names or list of such.

Currently, we only support ['count', 'mad', 'max', 'mean', 'median', 'min', 'mode', 'quantile', 'rank', 'sem', 'skew', 'sum', 'std', 'var']

axis

Currently, we only support axis=0 (index)

*args

Positional arguments to pass to func

**kwargs

Keyword arguments to pass to func

Returns
DataFrame, Series or scalar

if DataFrame.agg is called with a single function, returns a Series if DataFrame.agg is called with several functions, returns a DataFrame if Series.agg is called with single function, returns a scalar if Series.agg is called with several functions, returns a Series

Examples

>>> df = ed.DataFrame('localhost', 'flights')
>>> df[['DistanceKilometers', 'AvgTicketPrice']].aggregate(['sum', 'min', 'std']).astype(int)
     DistanceKilometers  AvgTicketPrice
sum            92616288         8204364
min                   0             100
std                4578             266