nispace.datasets.apply_collection
- nispace.datasets.apply_collection(data, collection)[source]
Re-index a parcellated-data DataFrame by a collection’s set/weight structure.
Restricts data to the maps present in collection and replaces its index with the collection’s columns (
map, andset/weightif present) as a MultiIndex — so a single map that belongs to multiple sets appears multiple times, once per set membership.- Parameters:
data (pd.DataFrame) – Parcellated data indexed by map name (rows = maps, columns = parcels).
collection (pd.DataFrame) – A collection DataFrame as returned by
fetch_collection(), with at least a"map"column.
- Returns:
data restricted to maps in collection, indexed by a MultiIndex of collection’s columns (
mapalone, or["set", "map"], or["set", "map", "weight"]).- Return type:
pd.DataFrame
- Raises:
ValueError – If collection has no
"map"column.