eelbrain.Dataset.aggregate

Dataset.aggregate(x=None, drop_empty=True, name='{name}', count='n', drop_bad=False, drop=(), equal_count=False, never_drop=(), func=<function mean>)

Return a Dataset with one case for each cell in x.

Parameters:
  • x (Factor | Interaction | NestedEffect | str) – Model defining cells to which to reduce cases. By default (None) the Dataset is reduced to a single case.

  • drop_empty (bool) – Drops empty cells in x from the Dataset. Currently has to be True.

  • name (str) – Name of the new Dataset.

  • count (bool | str) – Add a variable with this name to the new Dataset, containing the number of cases in each cell of x.

  • drop_bad (bool) – Drop bad items: silently drop any items for which compression raises an error. This concerns primarily factors with non-unique values for cells in x (if drop_bad is False, an error is raised when such a Factor is encountered)

  • drop (Sequence[str]) – Additional data-objects to drop.

  • equal_count (bool) – Make sure the same number of rows go into each average. First, the cell with the smallest number of rows is determined. Then, for each cell, rows beyond that number are dropped.

  • never_drop (Sequence[str]) – Raise an error if the drop_bad=True setting would lead to dropping a variable whose name is in never_drop.

  • func (Callable) – Function for aggregating numerical variables (Var and NDVar); default is numpy.mean()

Return type:

Dataset

Notes

Handle mne Epoch objects by creating a list with an mne Evoked object for each cell.