Trouble in encoding Data using python

Hello,
I am stuck in encoding my data which contains type string features to integers.
I am using
"
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder
ct = ColumnTransformer (transformers=[(‘encoder’,OneHotEncoder(),[3])],remainder=‘passthrough’)
X=np.array(ct.fit_transform(X))
"
by this code I can transform only one column “column id 3” but I have my others so how can I add
them to the script let’s say column “4,5 and 6”
thank you

Knowing nothing about sklearn, just looking at the code above:

ct = ColumnTransformer (transformers=[('encoder',OneHotEncoder(),[3])],remainder='passthrough')

that [3] is a list. Can you pass [3,4,5,6]? Read the documentation for
ColumnTransformer - it should make this clear.

It also seems that transformers is also a list. So in addition to
passing a OneHotEncoder() instance to transform column 3, you could also
include specific other transformers for other columns by adding more
values to the “transformers=[…]” list.

Again, this inference is basd entirely on just looking at the call
above. Read the documentation for the call - it should make things
clear.

Cheers,
Cameron Simpson cs@cskk.id.au