4. Evaluating and Choosing the Best Segmentation Approach
Activity 4.01: Optimizing a Luxury Clothing Brand's Marketing Campaign Using Clustering
Solution:
- Import the libraries required for DataFrame handling and plotting (pandas, numpy, matplotlib). Read in the data from the file 'Clothing_Customers.csv' into a DataFrame and print the top 5 rows to understand it better.
import numpy as np, pandas as pd
import matplotlib.pyplot as plt, seaborn as sns
data0 = pd.read_csv('Clothing_Customers.csv')
data0.head()
Note
Make sure you place the CSV file in the same directory from where you are running the Jupyter Notebook. If not, make sure you change the path (emboldened) to match the one where you have stored the file.
The result should be the table below:
Figure 4.24: Top 5 records of the data
The data contains the customers' income, age, days since their last purchase, and their annual spending. All these will be used to perform segmentation.
- Standardize...