Variable error with Onehotencoder

Asked

Viewed 18 times

0

When preprocessing a database, deleting part of the list, and reducing empty variables, one hot Encoder should classify the same database for the beginning of the ia tests. But it returns an error "Typeerror: 'Onehotencoder' Object is not iterable". I don’t know how to solve, here’s the code :

from sklearn.preprocessing import Labelencoder, Onehotencoder from sklearn.Compose import Columntransformer

labelencoder_predictors = Labelencoder() previsors[:, 0] = labelencoder_previsores.fit_transform(previsors[:,0]) previsors[:, 1] = labelencoder_previsores.fit_transform(previsors[:,1]) previsors[:, 3] = labelencoder_previsores.fit_transform(previsors[:,3]) previsors[:, 5] = labelencoder_previsores.fit_transform(previsors[:,5]) previsors[:, 8] = labelencoder_previsores.fit_transform(previsors[:,8]) previsors[:, 9] = labelencoder_previsores.fit_transform(previsors[:,9]) previsors[:, 10] = labelencoder_previsores.fit_transform(previsors[:,10])

onehotencoder = Columntransformer(Transformers=["Onehot", Onehotencoder(), [0,1,3,5,8,9,10]], remainder="passthrough")

previsors = onehotencoder.fit_transform(previsors). toarray()

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.