Solution: Preprocessing
Explore a practical preprocessing workflow using scikit-learn to prepare data for machine learning. Learn to impute missing values, one-hot encode categorical variables, discretize numeric features, and scale data effectively to create a ready-to-use dataset for modeling.
We'll cover the following...
We'll cover the following...
There are multiple potential solutions for this coding challenge, depending on the methods we choose for each preprocessing step. Here is one possible solution:
In the code above we cover the following preprocessing workflow:
Line 20: Instantiate a
SimpleImputerwith the strategy set tomeanto handle missing values.Line 21: Apply the imputer to fill in missing values in the numeric ...