使用 scipy.cluster.hierarchy.linkage进行层次聚类 from scipy.cluster.hierarchy import dendrogram, linkage,fcluster from matplotlib import pyplot as plt X = [[i] for i in [0.5, 1.5, 4.5]] # X = [[1,2],[3,2],[4,4],[1,2],[1,3]] Z = linkage(X, method= 'single') d