I have a dataset with 20+ columns each with categorical data. How do I encode those using sklearn in python. I tried LabelBinarizer, LabelEncoder, Onehotencoder but it does not work.
One of the error:
ValueError: Multioutput target data is not supported with label binarization
I am using a kaggle dataset
datasets = pd.read_csv('mushrooms.csv')
x = datasets.iloc[:, 1:23].values
y = datasets.iloc[:,0].values
from sklearn.model_selection import train_test_split
x_train,x_test,y_train,y_test = train_test_split(x,y,test_size=0.2,random_state=0)
from sklearn.preprocessing import LabelBinarizer
encoder = LabelBinarizer()
datasets_cat_hot = encoder.fit_transform(x_train)