LoslegenKostenlos loslegen

Pre-process data

First step in the segmentation process is to pre-process the data. You will apply log transformation, and then normalize the data to prepare it for clustering.

We have loaded the dataset with RFMT values as datamart_rfmt. Also, the pandas library is loaded as pd, and numpy as np.

Please feel free to explore the expanded RFMT dataset in the console.

Diese Übung ist Teil des Kurses

Customer Segmentation in Python

Kurs anzeigen

Anleitung zur Übung

  • Import StandardScaler, initialize it, ad store as scaler.
  • Apply log transformation to the raw RFMT data.
  • Initialize the scaler and fit it on the log-transformed data.
  • Transform and store the scaled data as datamart_rfmt_normalized.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Import StandardScaler 
from ____.____ import ____

# Apply log transformation
datamart_rfmt_log = ____.____(____)

# Initialize StandardScaler and fit it 
scaler = ____(); ____.fit(____)

# Transform and store the scaled data as datamart_rfmt_normalized
datamart_rfmt_normalized = ____.____(____)
Code bearbeiten und ausführen