skbio.metadata.MetadataColumn#

class skbio.metadata.MetadataColumn(series, missing_scheme='blank')[source]#

Abstract base class representing a single metadata column.

Concrete subclasses represent specific metadata column types, e.g. CategoricalMetadataColumn and NumericMetadataColumn.

See the Metadata class docstring for details about Metadata and MetadataColumn objects, including a description of column types.

The main difference in constructing MetadataColumn vs Metadata objects is that MetadataColumn objects are constructed from a pandas.Series object instead of a pandas.DataFrame. Otherwise, the same restrictions, considerations, and data normalization are applied as with Metadata objects.

Parameters:
seriespd.Series

The series to construct a column from.

missing_scheme“blank”, “no-missing”, “INSDC:missing”

How to interpret terms for missing values. These will be converted to NaN. The default treatment is to take no action.

Attributes

missing_scheme

Return the vocabulary used to encode missing values.

name

Metadata column name.

type

Attributes (inherited)

id_count

Number of metadata IDs.

id_header

Name identifying the IDs associated with the metadata.

ids

IDs associated with the metadata.

Methods

drop_missing_values

Filter out missing values from the metadata column.

filter_ids

Filter metadata column by IDs.

get_ids

Retrieve IDs matching search criteria.

get_missing

Return a series containing only missing values (with an index).

get_value

Retrieve metadata column value associated with an ID.

has_missing_values

Determine if the metadata column has one or more missing values.

to_dataframe

Create a pandas dataframe from the metadata column.

to_series

Create a pandas series from the metadata column.

Methods (inherited)

read

Create a new MetadataColumn instance from a file.

save

Save a TSV metadata file.

write

Write an instance of MetadataColumn to a file.

Special methods

__eq__

Determine if this metadata column is equal to another.

__ne__

Determine if this metadata column is not equal to another.

Special methods (inherited)

__ge__

Return self>=value.

__getstate__

Helper for pickle.

__gt__

Return self>value.

__le__

Return self<=value.

__lt__

Return self<value.

__str__

Return str(self).

Details

missing_scheme#

Return the vocabulary used to encode missing values.

This property is read-only.

Returns:
str

“blank”, “no-missing”, or “INSDC:missing”

name#

Metadata column name.

This property is read-only.

Returns:
str

Metadata column name.

type = None#
__eq__(other)[source]#

Determine if this metadata column is equal to another.

MetadataColumn objects are equal if their IDs, column names, column types, ID headers and metadata values are equal.

Parameters:
otherMetadataColumn

Metadata column to test for equality.

Returns:
bool

Indicates whether this MetadataColumn object is equal to other.

See also

__ne__
__ne__(other)[source]#

Determine if this metadata column is not equal to another.

MetadataColumn objects are not equal if their IDs, column names, column types, ID headers, or metadata values are not equal.

Parameters:
otherMetadataColumn

Metadata column to test for inequality.

Returns:
bool

Indicates whether this MetadataColumn object is not equal to other.

See also

__eq__