You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/user_guide/03_metadata.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -214,6 +214,18 @@ tsgroup.drop_info("coords")
214
214
print(tsgroup)
215
215
```
216
216
217
+
## Restricting metadata
218
+
Instead of dropping multiple metadata fields, you may want to restrict to a set of specified fields, i.e. select which columns to keep. For this operation, use the [`restrict_info()`](pynapple.TsGroup.restrict_info) method. Multiple metadata columns can be kept by passing a list of metadata names.
219
+
```{code-cell} ipython3
220
+
import copy
221
+
tsgroup2 = copy.deepcopy(tsgroup)
222
+
tsgroup2.restrict_info("region")
223
+
print(tsgroup2)
224
+
```
225
+
```{admonition} Note
226
+
The `rate` column will always be kept for a `TsGroup`.
227
+
```
228
+
217
229
## Using metadata to slice objects
218
230
Metadata can be used to slice or filter objects based on metadata values.
0 commit comments