import pandas as pd
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
df = pd.DataFrame(columns=["State", "Adult", "Senior","Children"])
df.loc[0] = ["California", 111, 2, 6 ]
df.loc[1] = ["Texas", 70, 2, 4 ]
df.loc[2] = ["Florida", 64, 4, 5 ]
df.loc[3] = ["Georgia", 25, 2, 3 ]
df.loc[4] = ["Alaska", 90, 1, 2 ]
df.loc[5] = ["Hawaii", 105, 2, 1 ]
df.loc[6] = ["Washington", 27, 3, 2 ]
df.loc[7] = ["Pennsylvania", 90, 2, 1 ]
df.loc[8] = ["Virginia", 63, 2, 3 ]
df.loc[9] = ["Arizona", 34, 2, 4 ]
df.loc[10] = ["Michigan", 22, 5, 2 ]
kmeans = KMeans(n_clusters=4)
y = kmeans.fit_predict(df[['Adult', 'Senior', 'Children']])
df['Cluster'] = y
centers = kmeans.cluster_centers_
plt.scatter(df.Adult, df.Senior, c=df.Cluster)
plt.scatter(centers[:,0],centers[:,1],color='black',marker='*',label='centroid')
plt.show()
For the Kmeans analysis broken out by state above, I would like to extract/identify elements out of each cluster, which are the closest to that cluster's centroid.

