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 beTrue
.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)
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 innever_drop
.func (Callable) – Function for aggregating numerical variables (
Var
andNDVar
); default isnumpy.mean()
- Return type:
Notes
Handle mne Epoch objects by creating a list with an mne Evoked object for each cell.