E-Commerce Customer Segmentation — RFM
20% of customers generate 64% of revenue. Retention budget moved from blanket discounting to 866 named accounts.
- Cleaned 541,909 raw transactions down to 392,692 valid rows in Pandas — duplicates, null customer IDs, cancellations and non-positive lines, each exclusion logged and counted.
- Scored all 4,338 customers in PostgreSQL with CTEs and
NTILE(5)window functions, concatenating a three-digit RFM score and mapping it to 11 business segments. - Surfaced 646 lapsing high-value accounts holding £1.03M of historic spend — the highest-ROI win-back list in the base.
- Pandas
- PostgreSQL
- Window functions
- Power BI
- DAX