skbio.table.Table.del_metadata#

Table.del_metadata(keys=None, axis='whole')[source]#

Remove metadata from an axis

Parameters:
keyslist of str, optional

The keys to remove from metadata. If None, all keys from the axis are removed.

axis{‘sample’, ‘observation’, ‘whole’}, optional

The axis to operate on. If ‘whole’, the operation is applied to both the sample and observation axes.

Raises:
UnknownAxisError

If the requested axis does not exist.

Examples

>>> from biom import Table
>>> import numpy as np
>>> tab = Table(np.array([[1, 2], [3, 4]]),
...             ['O1', 'O2'],
...             ['S1', 'S2'],
...             sample_metadata=[{'barcode': 'ATGC', 'env': 'A'},
...                              {'barcode': 'GGTT', 'env': 'B'}])
>>> tab.del_metadata(keys=['env'])
>>> for id, md in zip(tab.ids(), tab.metadata()):
...     print(id, list(md.items()))
S1 [('barcode', 'ATGC')]
S2 [('barcode', 'GGTT')]