eelbrain.Dataset.sub
- Dataset.sub(index=None, keys=None, name=None)[source]
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
strto retrieve a single item directly.name (str) – name for the new Dataset.
- Returns:
data – Either the
Datasetwith cases restricted toindex, or, ifkeyis astr, a single item restricted toindex.- Return type:
Dataset | data_object
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.