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(ids_to_keep)

Filter metadata column by IDs.

get_ids([where_values_missing])

Retrieve IDs matching search criteria.

get_missing()

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

get_value(id)

Retrieve metadata column value associated with an ID.

has_missing_values()

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

to_dataframe([encode_missing])

Create a pandas dataframe from the metadata column.

to_series([encode_missing])

Create a pandas series from the metadata column.

Methods (inherited)

read([format])

Create a new MetadataColumn instance from a file.

save(filepath[, ext])

Save a TSV metadata file.

write(file[, format])

Write an instance of MetadataColumn to a file.

Special methods

__eq__(other)

Determine if this metadata column is equal to another.

__ne__(other)

Determine if this metadata column is not equal to another.

Special methods (inherited)

__ge__(value, /)

Return self>=value.

__getstate__(/)

Helper for pickle.

__gt__(value, /)

Return self>value.

__le__(value, /)

Return self<=value.

__lt__(value, /)

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__