eland.DataFrame.aggregate

DataFrame.aggregate(self, 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'])
     DistanceKilometers  AvgTicketPrice
sum        9.261629e+07    8.204365e+06
min        0.000000e+00    1.000205e+02
std        4.578263e+03    2.663867e+02