nispace.io.load_labels
- nispace.io.load_labels(labels, concat=True, header=None, index=None)[source]
Load one or more label lists from paths, arrays, or Series.
- Parameters:
labels (str, os.PathLike, list, np.ndarray, pd.Series, or tuple) – A single label source, or a tuple of up to 2 such elements (e.g. left/right hemisphere label files). list/ndarray/Series elements are passed through as plain lists; str/Path elements are read as the first column of a csv-like text file.
concat (bool, default True) – If labels has 2 elements, whether to concatenate them into a single flat list (True) or return them as a 2-tuple (False).
header (int, optional) – Row index to use as column header when reading a csv-like file; forwarded to
pandas.read_csv.index (int, optional) – Column index to use as the row index when reading a csv-like file; forwarded to
pandas.read_csv.
- Returns:
A single flat list if labels had 1 element (or 2 with concat=True); otherwise a 2-tuple of lists.
- Return type:
list or tuple
- Raises:
ValueError – If labels is not a path/list/ndarray/Series/tuple thereof, or a path element can’t be read as a csv-like file.