eelbrain.load.tsv(path:str=None, names:Union[Sequence[str], bool]=True, types:Union[str, dict]=None, delimiter:str='auto', skiprows:int=0, start_tag:str=None, ignore_missing:bool=False, empty:Union[str, float]=None, random:Union[str, Sequence[str]]=None, **fmtparams)

Load a Dataset from a text file.

path : str

Path to the file (if omitted, use a system file dialog).

names : Sequence of str | bool

Column/variable names.

  • True (default): look for names on the first line of the file
  • ['name1', ...] use these names
  • False: use “v1”, “v2”, …
types : str | dict

Column data types:

- 'a': determine automatically
- 'f': Factor
- 'v': Var
- 'b': boolean Var

Specified either as string, with one type per columnc (e.g. 'ffvva') or as {column_name: data_type} dictionary (e.g. {'participant': 'f'}); unspecified columns default to 'a'.

delimiter : str

Value delimiting cells in the input file (default depends on path: ',' if the extension is '.csv', otherwise '\t').

skiprows : int

Skip so many rows at the beginning of the file (for tsv files with headers). Column names are expected to come after the skipped rows. skiprows is applied after start_tag.

start_tag : str

Alternative way to skip header rows. The table is assumed to start on the line following the last line in the file that starts with start_tag.

ignore_missing : bool

Ignore rows with missing values (i.e., lines that contain fewer delimiter than the others; by default this raises an IOError). For rows with missing values, NaN is substituted for numerical and "" for categorial variables.

empty : number | ‘nan’

For numerical variables, substitute this value for empty entries. For example, if a column in a file contains ['5', '3', ''], this is read by default as Factor(['5', '3', '']). With empty=0, it is read as Var([5, 3, 0]). With empty='nan', it is read as Var([5, 3, nan]).

random : str | sequence of str

Names of the columns that should be assigned as random factor.


Further formatting parameters for csv.reader(). For example, a fixed-width column file can be loaded with skipinitialspace=True (as long as there are no empty cells).