0 votes
1 view
in Data Science by (17.6k 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 (32.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.

If you wish to learn about scikit learn then visit this Scikit Learn Tutorial.

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


Categories

...