Complete the code to import the library used for customer segmentation.
import [1] as pd
We use pandas to handle data in tables, which is essential for customer segmentation.
Complete the code to load customer data from a CSV file.
data = pd.[1]('customers.csv')
To load data from a CSV file, we use pd.read_csv.
Fix the error in the code to select only numeric columns for clustering.
numeric_data = data.select_dtypes(include=[1])The correct keyword to select numeric columns is 'number'.
Fill both blanks to create a KMeans model and fit it to the numeric data.
from sklearn.cluster import [1] model = [2](n_clusters=3) model.fit(numeric_data)
We import and create a KMeans clustering model to segment customers.
Fill both blanks to add cluster labels to the data and show the first 5 rows.
data['cluster'] = model.[1](numeric_data) print(data.[2](5))
We use fit_predict to assign clusters and head to display the first 5 rows.
