maxframe.liteframe.LiteFrame.agg#

LiteFrame.agg(func=None, *, method='auto', numeric_only=None, input_frame_type='pandas', **kwargs)#

Aggregate using one or more operations over columns.

Each column is reduced independently to a single scalar, and the results are combined into a single-row LiteFrame.

Parameters:
  • func (str, list of str, or dict, optional) – Aggregation specification. A string names a single reduction (e.g. 'sum'); a list applies several reductions to each column, producing a single row with {column}_{function} suffixed columns (e.g. a_sum, a_mean); a dict maps column names to reductions. By default None, which supports the kwargs-only named-aggregation form (e.g. lf.agg(a_sum=('a', 'sum'))).

  • method ({'auto', 'tree', 'shuffle'}, default 'auto') – Execution strategy. 'auto' selects based on data size.

  • numeric_only (bool, optional) – When True, restrict to numeric columns. By default None.

  • input_frame_type (str, default 'pandas') – Frame type hint for the operator.

  • **kwargs – Additional keyword arguments forwarded to the reduction.

Returns:

Single-row LiteFrame of per-column aggregate results.

Return type:

LiteFrame

See also

sum

Return the sum of each column.

mean

Return the mean of each column.

count

Return the count of non-null values in each column.

Examples

>>> import maxframe.liteframe as mlf
>>> lf = mlf.LiteFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
>>> result = lf.agg('sum')
>>> result.execute()
   a  b
0  6  15
>>> result = lf.agg(['sum', 'mean'])
>>> result.execute()
   a_sum  a_mean  b_sum  b_mean
0      6     2.0     15     5.0