One-hot encoding

Geekscoach
1 min readJul 19, 2020

--

This technique helps to change categorical values to numerical values.

In the example see how the column Fuel is transform to two columns corresponding to values from the original column

Note: get_dummies return a new dataframe that is not included in the main dataframe

In other to include the result use concat() to merge the two data frames.

df = pd.concat([df, dummy_df], axis=1)

--

--