Customer Segmentation in Python
Learn how to segment customers in Python.
Start Course for Free4 hours17 videos55 exercises19,687 learnersStatement of Accomplishment
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?
Try DataCamp for BusinessLoved by learners at thousands of companies
Course Description
The most successful companies today are the ones that know their customers so well that they can anticipate their needs. Data analysts play a key role in unlocking these in-depth insights, and segmenting the customers to better serve them. In this course, you will learn real-world techniques on customer segmentation and behavioral analytics, using a real dataset containing anonymized customer transactions from an online retailer. You will first run cohort analysis to understand customer trends. You will then learn how to build easy to interpret customer segments. On top of that, you will prepare the segments you created, making them ready for machine learning. Finally, you will make your segments more powerful with k-means clustering, in just few lines of code! By the end of this course, you will be able to apply practical customer behavioral analytics and segmentation techniques.
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Marketing Analytics in Python
Go To Track- 1
Cohort Analysis
FreeIn this first chapter, you will learn about cohorts and how to analyze them. You will create your own customer cohorts, get some metrics and visualize your results.
Introduction to cohort analysis50 xpHow many customers acquired?50 xpCohort analysis50 xpAssign daily acquisition cohort100 xpCalculate time offset in days - part 1100 xpCalculate time offset in days - part 2100 xpCohort metrics50 xpCustomer retention50 xpCalculate retention rate from scratch100 xpCalculate average price100 xpVisualizing cohort analysis50 xpVisualize average quantity metric100 xp - 2
Recency, Frequency, and Monetary Value Analysis
In this second chapter, you will learn about customer segments. Specifically, you will get exposure to recency, frequency and monetary value, create customer segments based on these concepts, and analyze your results.
Recency, frequency, monetary (RFM) segmentation50 xpCalculate spend quartiles (q=4)100 xpCalculate recency deciles (q=4)100 xpCalculating RFM metrics50 xpLargest frequency value50 xpCalculate RFM values100 xpBuilding RFM segments50 xpCalculate 3 groups for recency and frequency100 xpCalculate RFM Score100 xpAnalyzing RFM table50 xpFind average value for RFM score segment50 xpCreating custom segments100 xpAnalyzing custom segments100 xp - 3
Data Preprocessing for Clustering
Once you created some segments, you want to make predictions. However, you first need to master practical data preparation methods to ensure your k-means clustering algorithm will uncover well-separated, sensible segments.
Data preprocessing50 xpAssumptions of k-means50 xpCalculate statistics of variables100 xpManaging skewed variables50 xpDetect skewed variables100 xpManage skewness100 xpCentering and scaling data50 xpCenter and scale manually100 xpCenter and scale with StandardScaler()100 xpPre-processing pipeline50 xpVisualize RFM distributions100 xpPre-process RFM data100 xpVisualize the normalized variables100 xp - 4
Customer Segmentation with K-means
In this final chapter, you will use the data you pre-processed in Chapter 3 to identify customer clusters based on their recency, frequency, and monetary value.
Practical implementation of k-means clustering50 xpRun k-means100 xpAssign labels to raw data100 xpChoosing the number of clusters50 xpCalculate sum of squared errors100 xpPlot sum of squared errors100 xpProfile and interpret segments50 xpPrepare data for the snake plot100 xpVisualize snake plot100 xpCalculate relative importance of each attribute100 xpPlot relative importance heatmap100 xpEnd-to-end segmentation solution50 xpPre-process data100 xpCalculate and plot sum of squared errors100 xpBuild 4-cluster solution100 xpAnalyze the segments100 xpFinal thoughts50 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Marketing Analytics in Python
Go To Trackcollaborators
prerequisites
Supervised Learning with scikit-learnKarolis Urbonas
See MoreHead of Machine Learning and Science
Karolis is currently leading a Machine Learning and Science team at Amazon Web Services. He's a data science enthusiast obsessed with machine learning, analytics, neural networks, data cleaning, feature engineering, and every engineering puzzle he can get his hands on.
What do other learners have to say?
Join over 15 million learners and start Customer Segmentation in Python today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.