calour.manipulation.join_metadata_fields

calour.manipulation.join_metadata_fields(exp: calour.experiment.Experiment, field1, field2, newfield=None, axis=0, sep='_', inplace=True)[source]

Join two sample/feature metadata fields into a single new field

Note

This function is also available as a class method Experiment.join_metadata_fields()

Parameters:
  • exp (Experiment) – Input experiment object.
  • field1 (str) – Name of the first sample metadata field to join
  • field2 (str) – Name of the second sample metadata field to join
  • newfield (str or None, optional) – name of the new (joined) sample metadata field None (default) to name it as field1 + sep + field2
  • axis (0, 1, 's', or 'f', optional) – 0 or ‘s’ (default) to modify sample metadata fields; 1 or ‘f’ to modify feature metadata fields
  • sep (str, optional) – The separator between the values of the two fields when joining
  • inplace (bool, optional) – True (default) to add in current experiment, False to create a new Experiment
Returns:

with an added sample metadata field

Return type:

Experiment