0
0
Data Analysis Pythondata~30 mins

Customer segmentation pattern in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Customer segmentation pattern
📖 Scenario: You work for a small online store. You want to group customers based on how much they spent last month. This helps the store send special offers to big spenders and thank smaller spenders.
🎯 Goal: Build a simple program that groups customers into 'High spender' and 'Low spender' based on their spending amount.
📋 What You'll Learn
Create a dictionary with customer names and their spending amounts.
Set a spending threshold to separate high and low spenders.
Use a dictionary comprehension to create a new dictionary with customer names and their segment ('High spender' or 'Low spender').
Print the final segmentation dictionary.
💡 Why This Matters
🌍 Real World
Stores and businesses often group customers by spending to target marketing and rewards effectively.
💼 Career
Data analysts and marketers use customer segmentation to improve sales strategies and customer satisfaction.
Progress0 / 4 steps
1
Create the customer spending data
Create a dictionary called customer_spending with these exact entries: 'Alice': 120, 'Bob': 75, 'Charlie': 200, 'Diana': 50, 'Evan': 180.
Data Analysis Python
Hint

Use curly braces {} to create a dictionary with the exact customer names and spending amounts.

2
Set the spending threshold
Create a variable called threshold and set it to 100. This will separate high spenders from low spenders.
Data Analysis Python
Hint

Just create a variable named threshold and assign it the value 100.

3
Create the customer segmentation dictionary
Use a dictionary comprehension to create a new dictionary called customer_segment. For each customer and spending in customer_spending.items(), assign 'High spender' if spending is greater than or equal to threshold, otherwise assign 'Low spender'.
Data Analysis Python
Hint

Use a dictionary comprehension with for name, spending in customer_spending.items() and a conditional expression to assign segments.

4
Print the customer segmentation
Write a print statement to display the customer_segment dictionary.
Data Analysis Python
Hint

Use print(customer_segment) to show the final dictionary.