[Python] get this error when i run the k-means code -> AttributeError: 'NoneType' object has...

Discussão em 'Python' iniciado por Stack, Novembro 29, 2024.

  1. Stack

    Stack Membro Participativo

    from sklearn.cluster import KMeans
    cs = []
    for i in range(1, 11):
    kmeans = KMeans(n_clusters = i, init = 'k-means++', max_iter = 300, n_init = 10, random_state = 0)
    kmeans.fit(X)
    cs.append(kmeans.inertia_)
    plt.plot(range(1, 11), cs)
    plt.title('The Elbow Method')
    plt.xlabel('Number of clusters')
    plt.ylabel('CS')
    plt.show()


    when I run this code, I have the following error:


    AttributeError: 'NoneType' object has no attribute 'split'
    ​

    Continue reading...

Compartilhe esta Página