pynapple.TsdFrame.drop_info#
- TsdFrame.drop_info(key)[source]#
Drop metadata based on metadata column name. Operates in place.
- Parameters:
key ((str, list)) – Metadata column name(s) to drop.
- Return type:
None
Examples
>>> import pynapple as nap >>> import numpy as np >>> metadata = {"l1": [1, 2, 3], "l2": ["x", "x", "y"], "l3": [4, 5, 6]} >>> tsdframe = nap.TsdFrame(t=np.arange(5), d=np.ones((5, 3)), metadata=metadata) >>> print(tsdframe) Time (s) 0 1 2 ---------- --- --- --- 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 3.0 1.0 1.0 1.0 4.0 1.0 1.0 1.0 Metadata ---------- --- --- --- l1 1 2 3 l2 x x y l3 4 5 6 dtype: float64, shape: (5, 3)
To drop a single metadata row:
>>> tsdframe.drop_info("l1") >>> tsdframe Time (s) 0 1 2 ---------- --- --- --- 0.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 2.0 1.0 1.0 1.0 3.0 1.0 1.0 1.0 4.0 1.0 1.0 1.0 Metadata ---------- --- --- --- l2 x x y l3 4 5 6 dtype: float64, shape: (5, 3)
To drop multiple metadata rows:
>>> tsdframe.drop_info(["l2", "l3"]) >>> tsdframe Time (s) 0 1 2 ---------- --- --- --- 0 1 1 1 1 1 1 1 2 1 1 1 3 1 1 1 4 1 1 1 dtype: float64, shape: (5, 3)