Skip to main content
`Ctrl`+`K`

# skbio.metadata.MetadataMixin.has_metadata

MetadataMixin.has_metadata()

  Determine if the object has metadata.

  An object has metadata if its `metadata` dictionary is not empty (i.e., has at least one key-value pair).

  Returns:
    bool

      Indicates whether the object has metadata.

  Examples

  Note

  scikit-bio objects with metadata share a common interface for accessing and manipulating their metadata. The following examples use scikit-bio’s `Sequence` class to demonstrate metadata behavior. These examples apply to all other scikit-bio objects storing metadata.

      >>> from skbio import Sequence
      >>> seq = Sequence('ACGT')
      >>> seq.has_metadata()
      False
      >>> seq = Sequence('ACGT', metadata={})
      >>> seq.has_metadata()
      False
      >>> seq = Sequence('ACGT', metadata={'id': 'seq-id'})
      >>> seq.has_metadata()
      True