Rule-based customer segmentation that creates level-based personas from demographic and behavioral data, then assigns revenue-based segment labels (A/B/C/D) for targeted marketing.
Given user demographic data (country, device, gender, age) and purchase history, create meaningful customer segments that predict the expected revenue from new customers with similar profiles.
- Data Merging — Join user demographics with purchase records
- Revenue Aggregation — Calculate total revenue per demographic group
- Age Binning — Convert continuous age into categorical brackets: 0–18, 19–23, 24–30, 31–40, 41–75
- Persona Construction — Create composite keys like
TUR_IOS_F_31_40(Country_Device_Gender_Age) - Revenue Scoring — Calculate mean revenue per persona
- Segmentation — Assign quartile-based segment labels using
pd.qcut:- A — Top 25% revenue (highest value)
- B — 50–75th percentile
- C — 25–50th percentile
- D — Bottom 25%
Given a new customer profile (e.g., Turkish, iOS user, Female, age 41–75), the model instantly returns their expected segment and predicted revenue range — enabling personalized marketing and pricing strategies.
- Python 3.8+ — Core language
- Pandas — Data manipulation, groupby aggregation, qcut segmentation
git clone https://github.com/eboekenh/Level_Based_Persona.git
cd Level_Based_Persona
pip install -r requirements.txt
python Level_based_persona.pyPlace users.csv and purchases.csv in the project root before running.
MIT