1.3 Practical Exercises for Chapter 1
These exercises provide hands-on practice for customer segmentation and data analysis techniques in retail and healthcare data. Each exercise is designed to strengthen your understanding of data preparation, exploration, and clustering techniques. Solutions with code are included for guidance.
Exercise 1: Handling Missing Values in Retail Data
You have a retail dataset with columns such as CustomerID, Age, Total Spend, and Purchase Frequency. Your task is to handle missing values as follows:
Drop rows with missing CustomerID.
Fill missing Age values with the median age.
Drop columns with more than 50% missing values.
# Sample retail data with missing values
data = {'CustomerID': [1, 2, None ...