import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
df_cust=pd.read_csv("Customers.csv")
df_cust.head()
df_cust.corr()
df_cust.columns
df_cust.drop(["CustomerID"],axis=1,inplace=True)
df_cust.plot.scatter(x='Age',y='Spending Score (1-100)')
sns.countplot(x='Genre',data=df_cust)
plt.figure(figsize=(12,10))
sns.countplot(x='Age',data=df_cust)
from sklearn.cluster import KMeans
X=df_cust[["Annual Income (k)","SpendingScore(1−100)"]]wcss=[]foriinrange(1,11):(−give−space−)km=KMeans(nclusters=i)(−give−space−)km.fit(X)(−give−space−)wcss.append(km.inertia)km1=KMeans(nclusters=5)km1.fit(X)y=km1.predict(X)dfcust["label"]=ydfcust.head()plt.figure(figsize=(10,6))sns.scatterplot(x=′AnnualIncome(k)',y = 'Spending Score (1-100)',hue="label",
palette=['green','orange','brown','dodgerblue','red'], legend='full',data = df_cust ,s = 60 )
plt.xlabel('Annual Income (k)′)plt.ylabel(′SpendingScore(1−100)′)plt.title(′SpendingScore(1−100)vsAnnualIncome(k)')
plt.show();