I'm trying to run a neural network. And I have some questions related to this error, beacuase I'm trying to convert categorical inputs into numerical ordinary input.
So the data equals:
so I used this code in order to be capable of handle those categorical input in the 'Test' and 'Measurement Stage' columns:
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split, KFold
from sklearn.preprocessing import StandardScaler, LabelEncoder
from keras.models import Sequential
from keras.layers import Dense
from keras.optimizers import Adam
from sklearn.metrics import r2_score
# Load your dataset
data = pd.read_excel('Teste JMP.xlsx')
# Separate the input features from the target outputs
X = data.drop(['Brookfield', 'Marsh'], axis=1).values
y = data[['Brookfield', 'Marsh']].values
# Apply label encoding to categorical columns
label_encoder = LabelEncoder()
X['Test'] = label_encoder.fit_transform(X['Test'])
Therefore, I obtained the error in the title. Can anyone help me?
I though the problem was the index type or the dataframe/numpy form, but when I switched the 'Marsh' for example for a number the error was this:
TypeError: Encoders require their input to be uniformly strings or numbers. Got ['float', 'int', 'str']