I am clustering the traders' data from past into cluster using Kmeans. I have 10 traders and I am clustering into 3 clusters. After getting clusters and labels of each index now I want to know the name of the traders each cluster has. For example if Cluster-0 has 3 traders then the output should be something like
{'Cluster0': 'Name1','Name2','Name3'}
{'Cluster1': 'Name5','Name4','Name6'}
and so on and so forth. I was able to get the index of data points which belong to each cluster by
cluster_dict = {i: np.where(data['Labels'] == i) for i in range(n_clusters)}
Then I have list of index from new trader data starts like 0-16 trader1, 16-32 trader2
and like that. I also have name of traders in list as ['name1','name2','name3']
.
Is there any way to get back the name of trader belongs to each cluster as I stated above. If yes then please help me with this.