Dummy encoding the categorical variables using the changed version of OneHotEncoder This is my code, I was trying to dummy encode the first column of X using OneHotEncoder but it was showing error and the documentation page of OneHotEncoder says that it has been changed and I wasn't able to figure out how I can do it using the changed version. the data type of X is numpy.ndarray.

from sklearn.preprocessing import LabelEncoder, OneHotEncoder
onehotencoder=OneHotEncoder(categorical_features = [0])
X[:, 0]=onehotencoder.fit_transform(X).toarray()
Did you try using 

X = pd.get_dummies(X)


?

Otherwise make sure that your X is either a 2D Array or a dataframe for OneHotEncoding to work.