WeCodeAcademy

Scaling Features

Some models compare distances (KNN, clustering) or learn with steps that depend on size (logistic regression). If one feature is in thousands and another in single digits, the big one dominates. StandardScaler rescales each feature to an average of 0 and a spread (standard deviation) of 1.

Examplepython
Open in editor »
Quick check

After StandardScaler, each column has a mean of about...

Your turn: write the code

Scale the data and print the scaled value of the first row's age, rounded to 2 decimals.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.