How does this array become this matrix?
0
0
Entering edit mode
2.5 years ago

Greetings.

While studying clustering analysis, I got a question which about Distance matrix.

In Biopython example code,

import numpy as np
import pandas as pd
from Bio.Cluster import distancematrix
data=np.array([[0, 1,  2,  3],[4, 5,  6,  7],[8, 9, 10, 11],[1, 2,  3,  4]])
matrix = distancematrix(data)
distances = distancematrix(data, dist='e')
print(distances)

This code's result is this:

[array([], dtype=float64), array([16.]), array([64., 16.]), array([ 1.,  9., 49.])]

but how can I convert this array for

enter image description here

this matrix?

Biopython • 424 views
ADD COMMENT

Login before adding your answer.

Traffic: 2395 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6