Skip to main content
`Ctrl`+`K`

# skbio.stats.distance.DissimilarityMatrix.filter

DissimilarityMatrix.filter(ids, strict=True)

  Filter the dissimilarity matrix by IDs.

  Parameters:
    ids iterable of str

      IDs to retain. May not contain duplicates or be empty. Each ID must be present in the dissimilarity matrix.

    strict bool, optional

      If strict is `True` and an ID that is not found in the distance matrix is found in ids, a `MissingIDError` exception will be raised, otherwise the ID will be ignored.

  Returns:
    DissimilarityMatrix

      Filtered dissimilarity matrix containing only the IDs specified in ids. IDs will be in the same order as they appear in ids.

  Raises:
    MissingIDError

      If an ID in ids is not in the object’s list of IDs.