skbio.stats.distance.DistanceMatrix.to_data_frame

DistanceMatrix.to_data_frame()[source]

Create a pandas.DataFrame from this DissimilarityMatrix.

State: Experimental as of 0.4.1.

Returns:

pd.DataFrame

pd.DataFrame with IDs on index and columns.

Examples

>>> from skbio import DistanceMatrix
>>> dm = DistanceMatrix([[0, 1, 2],
...                      [1, 0, 3],
...                      [2, 3, 0]], ids=['a', 'b', 'c'])
>>> df = dm.to_data_frame()
>>> df
   a  b  c
a  0  1  2
b  1  0  3
c  2  3  0