当前位置:网站首页>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
边栏推荐
- Modified BiotinDIAZO-Biotin-PEG3-DBCO|diazo-biotin-tripolyethylene glycol-diphenylcyclooctyne
- Response 重写设置返回值
- 安装IIS服务(Internet信息服务(Internet Information Services,简写IIS,互联网信息服务)
- 2017-06-11 Padavan 完美适配newifi mini【adbyby+SS+KP ...】youku L1 /小米mini
- 1054 求平均值 (20 分)
- flask 面试题 问题
- Business table analysis - balance system
- 快速上手 Mockito 单元测试框架
- ss-4.1-1个eurekaServer+1个providerPayment+1个consumerOrder
- 3. 无重复字符的最长子串
猜你喜欢

Redis6学习笔记

web安全-PHP反序列化漏洞
![[Harmony OS] [ARK UI] ETS context basic operations](/img/40/d5924477c42e2b3246eb212f4be534.png)
[Harmony OS] [ARK UI] ETS context basic operations

【HMS core】【Ads Kit】Huawei Advertising——Overseas applications are tested in China. Official advertisements cannot be displayed

Two ways to simulate multi-user login in Jmeter

typescript39-class类的可见修饰符

Install PostgreSQL on Windows

3. 无重复字符的最长子串

Pr第三次培训笔记

Modelarts第一次培训
随机推荐
Tributyl-mercaptophosphane "tBuBrettPhos Pd(allyl)" OTf), 1798782-17-8
Common fluorescent dyes to modify a variety of groups and its excitation and emission wavelength data in the data
1069 微博转发抽奖 (20 分)(C语言)
Unity2D horizontal board game tutorial 6 - enemy AI and attack animation
1095 解码PAT准考证 (25 分)(C语言)
odps的临时查询能在写sql的时候就给结果一个命名不?
Gradle的安装配置
[Harmony OS] [ARK UI] ETS context basic operations
FileZilla 搭建ftp服务器
【Harmony OS】【ARK UI】ets use startAbility or startAbilityForResult to invoke Ability
typescript44-对象之间的类兼容器
Newifi路由器第三方固件玩机教程,这个路由比你想的更强大以及智能_Newifi y1刷机_smzdm
Detailed explanation of MOSN reverse channel
Fluorescent marker peptides FITC/AMC/FAM/Rhodamine TAMRA/Cy3 / Cy5 / Cy7 - Peptide
web安全-SSTI模板注入漏洞
Pr第四次培训笔记
Kaggle(四)Scikit-learn
Flink state
4.如何避免缓存穿透、缓存击穿、缓存雪崩
Peptides mediated PEG DSPE of phospholipids, targeted functional materials - PEG - RGD/TAT/NGR/APRPG