Skip to content

Instantly share code, notes, and snippets.

@yashprakash13
Created December 26, 2021 16:29
Show Gist options
  • Save yashprakash13/360b8a14b417cbb567cd385fea390d61 to your computer and use it in GitHub Desktop.
Save yashprakash13/360b8a14b417cbb567cd385fea390d61 to your computer and use it in GitHub Desktop.
# COLUMN PIPELINE
from sklearn.impute import SimpleImputer
from sklearn.preprocessing import MinMaxScaler
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer
col_transformation_pipeline = Pipeline(steps=[
('impute', SimpleImputer(strategy='mean')),
('scale', MinMaxScaler())
])
all_columns = X_train.columns.tolist()
columns_transformer = ColumnTransformer(transformers=[
('cols', col_transformation_pipeline, all_columns),
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment