eelbrain.Datalist

class eelbrain.Datalist(items=None, name=None, fmt='repr')

list subclass for including lists in in a Dataset.

Parameters:
  • items (Sequence[Any]) – Content for the Datalist.

  • name (str) – Name of the Datalist.

  • fmt ('repr' | 'str' | 'strlist') – How to format items when converting Datasets to tables (default ‘repr’ uses the normal object representation).

Notes

Modifications:

  • adds certain methods that makes indexing behavior more similar to numpy and other data objects

  • blocks methods for in place modifications that would change the lists’s length

Examples

Concise string representation:

>>> l = [['a', 'b'], [], ['a']]
>>> print(Datalist(l))
[['a', 'b'], [], ['a']]
>>> print(Datalist(l, fmt='strlist'))
[[a, b], [], [a]]

Methods

aggregate(x[, func])

Summarize cases for each cell in x

append(p_object)

Append object to the end of the list.

clear()

Remove all items from list.

copy()

Return a shallow copy of the list.

count(value, /)

Return number of occurrences of value.

extend(iterable, /)

Extend list by appending elements from the iterable.

index(value[, start, stop])

Return first index of value.

insert(index, p_object)

Insert object before index.

pop([index])

Remove and return item at index (default last).

remove(value)

Remove first occurrence of value.

reverse()

Reverse IN PLACE.

sort(*[, key, reverse])

Sort the list in ascending order and return None.