Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created January 28, 2020 09:56
Show Gist options
  • Save lakshay-arora/64cd057fc97221f59f505c63071625fc to your computer and use it in GitHub Desktop.
Save lakshay-arora/64cd057fc97221f59f505c63071625fc to your computer and use it in GitHub Desktop.
import category_encoders as ce
# create an object of the OneHotEncoder
OHE = ce.OneHotEncoder(cols=['Item_Fat_Content',
'Item_Type',
'Outlet_Identifier',
'Outlet_Size',
'Outlet_Location_Type',
'Outlet_Type'],use_cat_names=True)
# encode the categorical variables
train_data = OHE.fit_transform(train_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment