Challenge: Creating a Pipeline
Use the original penguins.csv: first remove the two rows with insufficient data. Build one preprocessing pipeline that performs encoding, imputing, and scaling.
Only 'sex' and 'island' should be encoded, so use a ColumnTransformer. After that, apply SimpleImputer and StandardScaler to all features.
Here is a reminder of the make_column_transformer() and make_pipeline() functions you will use.
Swipe to start coding
- Import
make_pipeline. - Create
ctusingOneHotEncoderfor'sex'and'island', withremainder='passthrough'. - Build a pipeline:
ctβSimpleImputer('most_frequent')βStandardScaler. - Transform
Xand store the result inX_transformed.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.13
Challenge: Creating a Pipeline
Swipe to show menu
Use the original penguins.csv: first remove the two rows with insufficient data. Build one preprocessing pipeline that performs encoding, imputing, and scaling.
Only 'sex' and 'island' should be encoded, so use a ColumnTransformer. After that, apply SimpleImputer and StandardScaler to all features.
Here is a reminder of the make_column_transformer() and make_pipeline() functions you will use.
Swipe to start coding
- Import
make_pipeline. - Create
ctusingOneHotEncoderfor'sex'and'island', withremainder='passthrough'. - Build a pipeline:
ctβSimpleImputer('most_frequent')βStandardScaler. - Transform
Xand store the result inX_transformed.
Solution
Thanks for your feedback!
single