Skip to main content
`Ctrl`+`K`

# skbio.stats.distance.PairwiseMatrix.filter

PairwiseMatrix.filter(ids, strict=True)

  Filter the matrix by IDs.

  Parameters:
    ids sequence of str

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

    strict bool, optional

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

  Returns:
    PairwiseMatrix

      Filtered 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.

  Notes

  This function uses parallel computation for improved performance. See the parallelization guide for information on controlling the number of threads used.