Skip to main content

Customer Segmentation in Python

Learn how to segment customers in Python.

Start Course for Free
4 Hours17 Videos55 Exercises14,465 Learners4400 XPMarketing Analytics Track

Create Your Free Account



By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA. You confirm you are at least 16 years old (13 if you are an authorized Classrooms user).

Loved 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.

  1. 1

    Cohort Analysis


    In 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.

    Play Chapter Now
    Introduction to cohort analysis
    50 xp
    How many customers acquired?
    50 xp
    Cohort analysis
    50 xp
    Assign daily acquisition cohort
    100 xp
    Calculate time offset in days - part 1
    100 xp
    Calculate time offset in days - part 2
    100 xp
    Cohort metrics
    50 xp
    Customer retention
    50 xp
    Calculate retention rate from scratch
    100 xp
    Calculate average price
    100 xp
    Visualizing cohort analysis
    50 xp
    Visualize average quantity metric
    100 xp

In the following tracks

Marketing Analytics


hadrien-d4e73b49-bc29-46b7-a485-2f598f38e3b9Hadrien Lacroixmari-07494695-96a1-4a02-800a-956e6fd8c0caMari Nazary
Karolis Urbonas Headshot

Karolis Urbonas

Head 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.
See More

What do other learners have to say?

I've used other sites—Coursera, Udacity, things like that—but DataCamp's been the one that I've stuck with.

Devon Edwards Joseph
Lloyds Banking Group

DataCamp is the top resource I recommend for learning data science.

Louis Maiden
Harvard Business School

DataCamp is by far my favorite website to learn from.

Ronald Bowers
Decision Science Analytics, USAA