0 votes
1 view
in Data Science by (14.8k points)

I want to one-hot encode multiple columns in my data frame at once using Keras to_categorical. How to do it?

need_to_encode = ['Item_Fat_Content', 'Outlet_Location_Type', 'Outlet_Type', 'Outlet_Size', 'Item_Type_Combined', 'Outlet']

These are the columns I need to one-hot encode.

1 Answer

0 votes
by (23.5k points)

 

For the columns that need encoding of the data, you can use util function.

 You can also use scikit-learn's categorical encoder on the part of the dataframe you need to encode.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...