From http://scikit-learn.org/stable/modules/clustering.html#k-means the K-dimensional algorithm aims to select centroids that minimize inertia or the intra-cluster sum of the square of the criterion.
So, for each iteration of kilometers there is only one value of inertia. Are you trying to get k centroids values?
from sklearn import datasets from sklearn.cluster import KMeans iris = datasets.load_iris() X = iris.data Y = iris.target kmeans = KMeans(n_clusters=3, random_state=0,verbose=0).fit(X) print(kmeans.inertia_) print(kmeans.cluster_centers_)
source share