skbio.stats.distance.DistanceMatrix.to_data_frame¶
- DistanceMatrix.to_data_frame()[源代码]¶
创建
pandas.DataFrame
从这个开始DissimilarityMatrix
。状态:从0.4.1开始试验。
- 返回:
pd.DataFrame
在索引和列上具有ID。- 返回类型:
pd.DataFrame
示例
>>> 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.0 1.0 2.0 b 1.0 0.0 3.0 c 2.0 3.0 0.0