from scipy.cluster.vq import kmeans,vq
# input
data = DATA[["real"]]
ncores = 10
# computing K-Means with K = ncores (ncores clusters)
centroids,_ = kmeans(data,ncores,, max_iter = 300, n_jobs = 3) # values of centroids
# assign each value of dataset a respective cluster index (between 1 and ncores)
idx,_ = vq(data,centroids)