skbio.metadata.SampleMetadata.merge#

SampleMetadata.merge(*others)[source]#

Merge this Metadata object with other Metadata objects.

Returns a new Metadata object containing the merged contents of this Metadata object and others. The merge is not in-place and will always return a new merged Metadata object.

The merge will include only those IDs that are shared across all Metadata objects being merged (i.e. the merge is an inner join).

Each metadata column being merged must have a unique name; merging metadata with overlapping column names will result in an error.

Parameters:
otherstuple

One or more Metadata objects to merge with this Metadata object.

Returns:
Metadata

New object containing merged metadata. The merged IDs will be in the same relative order as the IDs in this Metadata object after performing the inner join. The merged column order will match the column order of Metadata objects being merged from left to right.

Raises:
ValueError

If zero Metadata objects are provided in others (there is nothing to merge in this case).

Notes

The merged Metadata object will always have its id_header property set to 'id', regardless of the id_header values on the Metadata objects being merged.