I’m a newby and having problems plotting labels for my kmeans data. I found some code and modified it for my purposes. I thought I had it right but the label numbers are wrong. I would greatly appreciate any help.

```
sns.scatterplot(data=df_scaled,x=kmeans.cluster_centers_[:,0], y=kmeans.cluster_centers_[:,1])
for i in range(df.shape[0]):
plt.text(kmeans.cluster_centers_[:,0][i]+0.2, kmeans.cluster_centers_[:,1][i]+0.2, s=cluster_new[“cluster_pred”][i],
fontdict=dict(color=‘red’, size=10),
bbox=dict(facecolor=‘yellow’, alpha=0.5))
```

This is the error message.

IndexError Traceback (most recent call last)

Input In [156], in <cell line: 22>()

20 sns.scatterplot(data=df_scaled,x=kmeans.cluster_centers_[:,0], y=kmeans.cluster_centers_[:,1])

22 for i in range(df.shape[0]):

—> 23 plt.text(kmeans.cluster_centers_[:,0][i]+0.2, kmeans.cluster_centers_[:,1][i]+0.2, s=cluster_new[“cluster_pred”][i],

24 fontdict=dict(color=‘red’, size=10),

25 bbox=dict(facecolor=‘yellow’, alpha=0.5))

26 #This was supposed to plot the labels for the cluster centres but the labelling gets screwed up somehow

28 plt.title(‘K Means Cluster Analysis - Banknote Authentication’)