求心率的peason相关系数的时候遇到这个问题:
TypeError: 'float' object is not iterable
解决方法:
pre_label.extend(output)
type(output)
<class 'float'>
type(pre_label)
<class 'list'>
改成 pre_label.append(output) 就可以了
append 和 expand 区别在哪里
https://www.cnblogs.com/subic/p/6553187.html
我没从例子上看出来区别
本文解决了在计算心率数据的Pearson相关系数时出现的TypeError:'float' object is not iterable错误。错误原因是将浮点数类型的数据尝试添加到列表中,正确的做法应该是使用append而非extend方法。
4万+





