Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Last active January 28, 2020 14:15
Show Gist options
  • Save lakshay-arora/78e837428d481c635b37146aa7ba104f to your computer and use it in GitHub Desktop.
Save lakshay-arora/78e837428d481c635b37146aa7ba104f to your computer and use it in GitHub Desktop.
# pre-processsing step
# Drop the columns -
# Impute the missing values in column Item_Weight by mean
# Scale the data in the column Item_MRP
pre_process = ColumnTransformer(remainder='passthrough',
transformers=[('drop_columns', 'drop', ['Item_Identifier',
'Outlet_Identifier',
'Item_Fat_Content',
'Item_Type',
'Outlet_Identifier',
'Outlet_Size',
'Outlet_Location_Type',
'Outlet_Type'
]),
('impute_item_weight', SimpleImputer(strategy='mean'), ['Item_Weight']),
('scale_data', StandardScaler(),['Item_MRP'])])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment