1. Learn
  2. /
  3. Courses
  4. /
  5. Preprocessing for Machine Learning in Python

Connected

Exercise

Scaling data - standardizing columns

Since we know that the Ash, Alcalinity of ash, and Magnesium columns in the wine dataset are all on different scales, let's standardize them in a way that allows for use in a linear model.

Instructions

100 XP
  • Import the StandardScaler class.
  • Instantiate a StandardScaler() and store it in the variable, scaler.
  • Create a subset of the wine DataFrame containing the Ash, Alcalinity of ash, and Magnesium columns, assign it to wine_subset.
  • Fit and transform the standard scaler to wine_subset.