text_plain_output_1.png
from sklearn.cluster import KMeans

import pandas as pd

path = '../input/iris/Iris.csv'
data = pd.read_csv(path)

y = data.Species

data.drop(['Id', 'Species'], axis=1, inplace=True)

data.shape

x = data.iloc[:].values

from sklearn.cluster import KMeans
wcss = []
for i in range(1, 11):
    kmeans = KMeans(n_clusters=i, init='k-means++', n_init=10, max_iter=300, random_state=0)
    kmeans.fit(x)
    wcss.append(kmeans.inertia_)

for i in range(0, 10):
    print('{} : {}'.format(i + 1, wcss[i]))