Project 04 · Clustering
Exploring customer segments
Using scaling, PCA, and K-means to explore patterns in customer purchasing and campaign-response data.
Download notebook ↓ · All projects
Data: 2,240 customer rows · 29 fields before preprocessing
Period: Dataset snapshot
Tools: Python, pandas, scikit-learn, SciPy, Seaborn, Matplotlib
Question
Can purchasing and engagement patterns be grouped into a small number of customer segments?
Approach
The notebook removes Education and Marital_Status, standardizes numeric columns, uses PCA and an elbow/silhouette review to explore cluster counts, then fits K-means with three clusters.
Prepare numeric features
The notebook removes two categorical fields, checks missingness, standardizes numeric columns, and excludes incomplete rows before PCA and clustering.
Explore the structure
A three-component PCA view and elbow/silhouette diagnostics are used to examine candidate groupings.
Inspect the segments
K-means with three clusters yields groups of 1,040, 635, and 541 records, then boxplots compare standardized features.
Findings and limitations
Observed finding
After rows with missing values are dropped, 2,216 records remain. The selected three-cluster run contains groups of 1,040, 635, and 541 records. Correlation and cluster-profile plots help inspect patterns; the notebook does not establish a validated customer strategy.
What to keep in mind
The analysis omits two categorical fields, includes ID among standardized numeric features, and drops 24 rows with missing values. Those choices can affect distance-based clusters. The three groups need further validation and substantive interpretation before being used for business decisions.
Next iteration: I would exclude identifier columns, encode categorical variables deliberately, compare cluster stability across seeds, and validate any proposed segment against outcomes not used to create it.
Selected figures




Notebook and source data
The notebook preserves the analysis code with saved outputs removed and data paths normalized to a local data folder. Dataset files are not bundled; consult the notebook README and obtain appropriately licensed source data before running it.
- customer_segmentation.csv (source described in the notebook as Kaggle)