pynapple.IntervalSet.restrict_info#
- IntervalSet.restrict_info(key)[source]#
Restrict metadata columns to a key or list of keys.
Examples
>>> import pynapple as nap >>> import numpy as np >>> times = np.array([[0, 5], [10, 12], [20, 33]]) >>> metadata = {"l1": [1, 2, 3], "l2": ["x", "x", "y"], "l3": [4, 5, 6]} >>> ep = nap.IntervalSet(tmp,metadata=metadata) >>> ep index start end l1 l2 l3 0 0 5 1 x 4 1 10 12 2 x 5 2 20 33 3 y 6 shape: (3, 2), time unit: sec.
To restrict to multiple metadata columns:
>>> ep.restrict_info(["l2", "l3"]) >>> ep index start end l2 l3 0 0 5 x 4 1 10 12 x 5 2 20 33 y 6 shape: (3, 2), time unit: sec.
To restrict to a single metadata column:
>>> ep.restrict_info("l2") >>> ep index start end l2 0 0 5 x 1 10 12 x 2 20 33 y shape: (3, 2), time unit: sec.