eelbrain.Datalist

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

list subclass for including lists in in a Dataset.

Parameters:
items : sequence

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(self, x[, merge]) Summarize cases for each cell in x
append(self, p_object)
clear()
copy()
count()
extend()
index() Raises ValueError if the value is not present.
insert(self, index, p_object) L.insert(index, object) – insert object before index
pop(self[, index]) Raises IndexError if list is empty or index is out of range.
remove(self, value) Raises ValueError if the value is not present.
reverse() L.reverse() – reverse IN PLACE
sort()