For classification, I was trying to convert categorical data into numeric by applying OneHotEncoder. But it shows error
could not convert string to float
Here is the sample of my categorical data set and code of One Hot Encoding.
# TODO: create a OneHotEncoder object, and fit it to all of X
from sklearn.preprocessing import OneHotEncoder
# 1. INSTANTIATE
enc = OneHotEncoder()
# 2. FIT
# 3. Transform
train_ = enc.transform(train_obj)
I couldn't understand what's the problem & how could I solve it.
If I apply
get_dummies() method, is it similar of OneHotEncoder ?