OiO.lk Blog python How do I onehotencode a single column in a dataframe?
python

How do I onehotencode a single column in a dataframe?


I have a dataframe called "vehicles" with 8 columns. 7 are numerical but the column named ‘Car_name’ which is index 1 in the dataframe and is categorical. i need to encode it

i tried this code and wont work

ohe = OneHotEncoding(categorical_features = [1])

vehicles_enc = ohe.fit_transform(vehicles).toarray()

TypeError: OneHotEncoder.__init__() got an unexpected keyword argument 'categorical_features'

this however works perfectly in a youtube vid i used.



You need to sign in to view this answers

Exit mobile version