skbio.table.Table.to_dataframe#

Table.to_dataframe(dense=False)[source]#

Convert matrix data to a Pandas SparseDataFrame or DataFrame

Parameters:
densebool, optional

If True, return pd.DataFrame instead of pd.SparseDataFrame.

Returns:
pd.DataFrame or pd.SparseDataFrame

A DataFrame indexed on the observation IDs, with the column names as the sample IDs.

Notes

Metadata are not included.

Examples

>>> from biom import example_table
>>> df = example_table.to_dataframe()
>>> df
     S1   S2   S3
O1  0.0  1.0  2.0
O2  3.0  4.0  5.0