1

I am on a machine learning project. I did import all libraries. I took one column of data(this column is array of bool) and i want to apply it labelencoder. Here is my whole code.

data = pd.read_csv('odev_tenis.csv')

le = preprocessing.LabelEncoder()

ruzgar = data.iloc[:,3:4].values #the column i want to apply labelencoder
ruzgar[:,3:4] = le.fit_transform(data.iloc[:,3:4])

And here is the error i got.

ValueError: could not broadcast input array from shape (14,) into shape (14,0)
metkopetru
  • 27
  • 7

1 Answers1

1

data.iloc[:,3:4] does not return a Series but a DataFrame of 1 column. Try:

ruzgar = le.fit_transform(data.iloc[:, 3])
Corralien
  • 109,409
  • 8
  • 28
  • 52