So i have a PandasDataFrame with categorical variables in a column which i want to one hot encode i've used the following code from an ML udemy course
from sklearn.preprocessing import OneHotEncoder
onehotencoder=OneHotEncoder(categorical_features=[10])
Y= onehotencoder.fit_transform(X).toarray()
However i get the following error
ValueError: could not convert string to float:
A bit of information Y is converted to an object from a df using
Y=df.iloc[:,:].values
I want to oneHotencode the 10th column of y which contains string values. The type of Y in variable explorer is object and if execute
type(Y)
i get numpy.ndarray
I'm new to Pandas and sklearn and would really appreciate any help.