from sklearn.cluster import KMeans kmeans = KMeans(n_clusters=6) kmeans.fit(data) labels = kmeans.labels_