I have a fairly large dataframe with both numerical and categorical values. I'm trying to encode the categorical values but am getting the above error.
Here's a simple version of the code:
from collections import defaultdict
d = defaultdict(LabelEncoder)
# Encoding the variable
fit = df[catgoricalValues].apply(lambda x: d[x.name].fit_transform(df[catgoricalValues]))
I'm using the approach described here, except instead of applying it on the entire dataframe, I specified the columns to encode.
I get this error:
ValueError: bad input shape (490546, 11)