calour.experiment.Experiment.to_pandas

Experiment.to_pandas(sample_field=None, feature_field=None, sparse=None)[source]

Get a pandas dataframe of the abundances Samples are rows, features are columns. Can specify the metadata fields for the index (default is sample_metadata index) and column labels (default is feature_metadata index)

Parameters:
  • sample_field (str or None, optional) – Name of the sample_metadata column to use for index. None (default) is the sample_metadata index
  • feature_field (str or None, optional) – Name of the feature_metadata column to use for column names. None (default) is the feature_metadata index
  • sparse (bool or None, optional) – None (default) to get sparsity based on the underlying Experiment sparsity True to force to sparse pandas.Dataframe False to force to standard pandas.Dataframe
Returns:

Return type:

pandas.Dataframe or pandas.SparseDataFrame