Untitled
unknown
plain_text
24 days ago
620 B
8
Indexable
import panda as pd
import matplotlib.pyplot as plt
from sklearn.cluster import KMeans
data = {
'CustomerID':[1,2,3,4,5,6,7,8,9,10],
'Anual Income ($)':[15, 16, 17 , 45, 47, 85 , 86, 87 , 88 ],
'
}
df= pd.DataFrame(data)
x=df[['Anual Income ($)']]
model=
plt.scatter(X['Annual Income ($)'], X['Spending Score '], c='gray')
plt.xlabel('Annual Income')
plt.ylabel('Spending Score')
plt.title('Annual Income vs Spending Score')
plt.show()
kmeans= KMeans(n_clusters=3)
df['Cluster']
colors=['red','green','blue']
for i in range(3):
plt.scatter(df[df['Cluster']==i]['Spending Score']Editor is loading...
Leave a Comment