eelbrain.Dataset.sub

Dataset.sub(self, index=None, keys=None, name=None)

Access a subset of the data in the Dataset.

Parameters:
index : int | array | str

Index for selecting a subset of cases. Can be an valid numpy index or a string (the name of a variable in Dataset, or an expression to be evaluated in the Dataset’s namespace).

keys : sequence of str | str

Only include items with those keys (default all items). Use a str to retrieve a single item directly.

name : str

name for the new Dataset.

Returns:
data : Dataset | data_object

Either the Dataset with cases restricted to index, or, if key is a str, a single item restricted to index.

Notes

Index is passed on to numpy objects, which means that advanced indexing always returns a copy of the data, whereas basic slicing (using slices) returns a view.