Skip to main content
`Ctrl`+`K`

# skbio.stats.distance.SymmetricMatrix.as_condensed

SymmetricMatrix.as_condensed()

  Return a condensed form deep copy of the matrix.

  Returns:
    SymmetricMatrix

      A new matrix object with the same data stored in condensed form.

  See also

  `condensed_form`
  `redundant_form`
  `as_redundant`

  Notes

  This method always returns a new matrix object, even if the matrix is already in condensed form. The new matrix object is a deep copy of the original matrix. This format is compatible with SciPy’s `scipy.spatial.distance.squareform`.

  Examples

      >>> from skbio.stats.distance import SymmetricMatrix
      >>> sm = SymmetricMatrix([[0, 1, 2],
      ...                       [1, 0, 3],
      ...                       [2, 3, 0]], ids=['a', 'b', 'c'])
      >>> sm_condensed = sm.as_condensed()
      >>> sm_condensed.data
      array([ 1., 2., 3.])