At a glance
The 60-second version
- The question. Which customers are worth the most to the mall, and how should marketing spend be split between them?
- What I did. Grouped 200 customers into five segments with K-Means clustering, using age, annual income and a 1–100 spending score.
- What I found. One group stands out: high-income, high-spending customers (about 39 shoppers, mostly in their early 30s). Another group spends a lot on lower incomes. A third has high income but spends very little, which is untapped potential.
- What I recommend. Put premium offers and loyalty programmes behind the prime group, run trend and value-for-money campaigns for the high spenders on lower incomes, and keep light-touch brand awareness for the rest.
The business question
The mall's management team wanted to understand its customer base in order to:
- identify high-value customers;
- optimise marketing spend;
- design targeted campaigns for different customer segments; and
- let the marketing team drill down to individual customers.
Rather than treating all customers the same, clustering lets the business make decisions based on how people actually spend.
What I found

| Segment | Customers | Avg. age | Avg. income (k$) | Avg. spending score | How I read it |
|---|---|---|---|---|---|
| 1 | 39 | 33 | 87 | 82 | Prime customers. High income, high spending |
| 2 | 22 | 25 | 26 | 79 | Enthusiastic spenders. Lower income, high spending |
| 0 | 81 | 43 | 55 | 50 | Mainstream. Middle income, middle spending |
| 3 | 35 | 41 | 88 | 17 | Untapped potential. High income, low spending |
| 4 | 22 | 46 | 27 | 20 | Low priority. Lower income, low spending |
Segment numbers are the cluster labels in the exported CSV; the descriptive names are mine. Averages are computed from that file.
Recommendations by segment
Prime customers
The most valuable group. Prioritise premium offerings, loyalty programmes and exclusive promotions.
Enthusiastic spenders
Selective but intentional. Highlight trending products, promotions and value-for-money offers.
Everyone else
Less immediate revenue potential. Keep up brand awareness and social media marketing without heavy targeted spend. Test what would move the high-income, low-spending group.
Under the hood
Method
- Explore and clean. Loaded and inspected the data, checked for missing values and consistency (univariate and bivariate analysis).
- Select features. Age, annual income and spending score.
- Choose the number of clusters. Used the elbow method: fit K-Means for k = 1 to 10 and plot the inertia (within-cluster sum of squares), then look for the bend.
- Cluster. K-Means from scikit-learn with
random_state=42for reproducibility. I clustered three ways: income vs spending, age vs spending, and all three features together. - Visualise. Plotted clusters with their centroids with seaborn and matplotlib.

# Inertia for different values of k (multivariate clustering)
inertia_values3 = []
for k in range(1, 11):
kmeans = KMeans(n_clusters=k, random_state=42)
kmeans.fit(df3)
inertia_values3.append(kmeans.inertia_)
plt.plot(range(1, 11), inertia_values3, marker='o')
plt.title('Elbow Method for Optimal k (Multivariate Clustering)')
plt.xlabel('Number of clusters (k)')
plt.ylabel('Inertia')
plt.savefig('elbow_multivariate.png')
plt.show()
# Plot clusters with centroids
plt.figure(figsize=(10, 6))
sns.scatterplot(data=centres, x='Annual Income (k$)', y='Spending Score (1-100)',
s=200, color='black', label='Centroids')
sns.scatterplot(data=df2, x='Annual Income (k$)', y='Spending Score (1-100)',
hue='Cluster_Income_Spending', palette='Set1')
plt.title('Clusters of Annual Income vs Spending Score with Centroids')
plt.xlabel('Annual Income (k$)')
plt.ylabel('Spending Score (1-100)')
plt.legend()
plt.savefig('clusters_with_centroids.png')
plt.show()
Dataset
The data has three behavioural variables: Age, Annual Income (k$) and Spending Score (1–100), a metric representing customer spending behaviour at the mall. The exported file adds two columns, Cluster_Income_Spending and Cluster_Age_Spending, so the marketing team can filter to any segment.
Limitations and next steps
- Small dataset. Two hundred customers is enough to demonstrate the method but not to size a campaign.
- The spending score is a given metric. I did not have the underlying transactions, so the segments describe behaviour as scored, not revenue.
- Cluster labels are not business labels. The names above are my interpretation and should be validated with the marketing team.
- Next: scale the features before multivariate clustering, compare with silhouette scores, and reconcile the 199 rows in the exported CSV with the 200 customers in the source dataset.