当前位置:网站首页>Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
Length n of condensed distance matrix ‘y‘ must be a binomial coefficient
2022-08-03 05:10:00 【xiaozheng123121】
在利用层次聚类算法的时候,报错:
ValueError: Length n of condensed distance matrix 'y' must be a binomial coefficient, i.e.there must be a k such that (k \choose 2)=n)!
import scipy.cluster.hierarchy as hcluster
df = df.iloc[:2000, :].apply(lambda x: sum(x), axis=1)
linkage = hcluster.linkage(df, method='centroid')
注:我的df是一个Series,而不是dataframe,改成Dataframe格式即可
linkage = hcluster.linkage(pd.DataFrame(df), method='centroid')
参考资料
[1] scipy.cluster.hierarchy.linkage 2020.5
边栏推荐
猜你喜欢

Pr第二次培训笔记

Unity2D horizontal board game tutorial 6 - enemy AI and attack animation

flask 面试题 问题

FileZilla 搭建ftp服务器

Power button 561. An array of split

Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG

IO process thread -> thread -> day5
![[Harmony OS] [ArkUI] ets development graphics and animation drawing](/img/36/f4c91f794b1321f11a24505d1617fb.png)
[Harmony OS] [ArkUI] ets development graphics and animation drawing
网络流媒体下载的 10 种方法(以下载 Echo 音乐为例)

【Harmony OS】【FAQ】Hongmeng Questions Collection 1
随机推荐
ModelArts第二次培训
斐讯K2路由编译Padavan华硕固件和心得
13.< tag-动态规划和回文字串>lt.647. 回文子串 + lt.516.最长回文子序列
【Biotin Azide|cas:908007-17-0】Price_Manufacturer
The problem that the rosbag tool plotjuggler cannot open rosbag
【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed
shell脚本循环语句
Presto installation and deployment tutorial
typescript45-接口之间的兼容性
Djiango第二次培训
Common lipophilic cell membrane dyes DiO, Dil, DiR, Did spectrograms and experimental procedures
ss-1.curl (cloud-provider-payment8001)
2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini
Exception(异常) 和 Error(错误)区别解析
在树莓派上搭建属于自己的网页(2)
junit总结
初步认识ZK
Super handy drawing tool is recommended
HarmonyOS应用开发培训第二次作业
Interface test practice | Detailed explanation of the difference between GET / POST requests