skbio.table.Table.head#
- Table.head(n=5, m=5)[source]#
Get the first n rows and m columns from self
- Parameters:
- nint, optional
The number of rows (observations) to get. This number must be greater than 0. If not specified, 5 rows will be retrieved.
- mint, optional
The number of columns (samples) to get. This number must be greater than 0. If not specified, 5 columns will be retrieved.
- Returns:
- Table
The subset table.
- Raises:
- IndexError
If n or m are <= 0.
Notes
Like head for Linux like systems, requesting more rows (or columns) than exists will silently work.
Examples
>>> import numpy as np >>> from biom.table import Table >>> data = np.arange(100).reshape(5, 20) >>> obs_ids = ['O%d' % i for i in range(1, 6)] >>> samp_ids = ['S%d' % i for i in range(1, 21)] >>> table = Table(data, obs_ids, samp_ids) >>> print(table.head()) # Constructed from biom file #OTU ID S1 S2 S3 S4 S5 O1 0.0 1.0 2.0 3.0 4.0 O2 20.0 21.0 22.0 23.0 24.0 O3 40.0 41.0 42.0 43.0 44.0 O4 60.0 61.0 62.0 63.0 64.0 O5 80.0 81.0 82.0 83.0 84.0