text_plain_output_1.png
from sklearn.compose import ColumnTransformer

from sklearn.preprocessing import OneHotEncoder

import numpy as np

import numpy as np # linear algebra

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

dataset = pd.read_csv('../input/drug-classification/drug200.csv')

dataset.replace(to_replace=['drugA', 'drugB', 'drugC', 'drugX', 'DrugY'], value=[0, 1, 2, 3, 4], inplace=True)
X = dataset.iloc[:, :-1].values
Y = dataset.iloc[:, -1].values

from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ohe = OneHotEncoder()
ct = ColumnTransformer(transformers=[('encoder', ohe, [2])], remainder='passthrough')
X = np.array(ct.fit_transform(X))
X[0]