This project involves performing customer segmentation and RFM (Recency, Frequency, Monetary) analysis on customer data from a retail company. The primary goal is to categorize customers into segments based on their buying behavior and identify potential target groups for marketing campaigns.
The dataset used for this project is sourced from a CSV file named "flo_data_20k.csv."
- Load the dataset from the CSV file.
- Display information about the dataset, including its shape, data types, and summary statistics.
- Create new variables for the total number of purchases and total spending for each customer.
- Convert date columns in the dataset to the date format.
- Define the Recency, Frequency, and Monetary metrics.
- Calculate the Recency, Frequency, and Monetary metrics for each customer.
- Assign these metrics to variables named
recency
,frequency
, andmonetary
. - Change the names of the metrics to
Recency
,Frequency
, andMonetary
.
- Convert the
Recency
,Frequency
, andMonetary
metrics into scores between 1 and 5 using quantiles (qcut). - Create new columns
recency_score
,frequency_score
, andmonetary_score
to store the scores. - Calculate the RFM score by combining
recency_score
andfrequency_score
as a single variable namedrfm_score
.
- Define segments based on RFM scores using a segmentation map.
- Create a new column
segment
to store the segment labels.
- Analyze the averages of Recency, Frequency, and Monetary metrics for each segment.
- Identify specific customer profiles for targeted marketing: a. Target customers who are loyal and female shoppers for a new women's shoe brand promotion. b. Target customers who are about to sleep or new customers for up to 40% discount promotions on Men's and Children's products.
- Save the customer IDs of the selected profiles to CSV files.
- Clone this repository to your local machine.
- Ensure you have Python and required libraries (pandas, numpy, matplotlib, seaborn, datetime) installed.
- Run the Jupyter Notebook or Python script to execute the code.
- Review the generated CSV files for targeted customer IDs.
Enjoy performing customer segmentation and RFM analysis with this project!