skbio.table.Table.pa#
- Table.pa(inplace=True)[source]#
Convert the table to presence/absence data
- Parameters:
- inplacebool, optional
Defaults to
True
- Returns:
- Table
Returns itself if inplace, else returns a new presence/absence table.
Examples
>>> from biom.table import Table >>> import numpy as np
Create a 2x3 BIOM table
>>> data = np.asarray([[0, 0, 1], [1, 3, 42]]) >>> table = table = Table(data, ['O1', 'O2'], ['S1', 'S2', 'S3'])
Convert to presence/absence data
>>> _ = table.pa() >>> print(table.data('O1', 'observation')) [ 0. 0. 1.] >>> print(table.data('O2', 'observation')) [ 1. 1. 1.]