Im trying to convert car names from NumPy array to numeric values to use for linear regressor. The label encoder gives warning: ValueError: could not convert string to float: 'porsche' Can someone help, please?
Heres the code:
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import LabelEncoder, OneHotEncoder
enc = LabelEncoder()
enc.fit_transform(Z[:,0:1])
onehotencoder = OneHotEncoder(categorical_features = [0])
Z = onehotencoder.fit_transform(Z).toarray()`
and outoput: ValueError: could not convert string to float: 'porsche'
And here is the array: Array name = Z, type str416,