python聚类错误

if __name__=='__main__': 
    dataset = createDataSet()
    
    centroids, cluster = kmeans(dataset, 3)
    print('质心为:%s' % centroids)
    print('集群为:%s' % cluster)
    for i in range(len(dataset)):
        label_pred = estimator.labels_  # 获取聚类标签
        # 绘制k-means结果
        x0 = X[label_pred == 0]
        x1 = X[label_pred == 1]
        x2 = X[label_pred == 2]
        plt.scatter(x0[:, 0], x0[:, 1], c="deeppink", marker='o', label='label0')
        plt.scatter(x1[:, 0], x1[:, 1], c="green", marker='*', label='label1')
        plt.scatter(x2[:, 0], x2[:, 1], c="blue", marker='+', label='label2')
      
        for j in range(len(centroids)):
            plt.scatter(centroids[j][0],centroids[j][1],marker='x',color='red',s=70,label='质心')
        
    plt.show()


错误:UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype(' None
这应该怎么改,找不到办法了,dataset类型是list,excel是两列float,代过鸢尾花数据运行了,现在不知道哪里有问题

https://blog.csdn.net/fuck11111100/article/details/114954399
大概原因就是类型不匹配
但是你代码里有太多东西没放出来,只能自己查原因了