So i have to apply this one by one to each column?
Neural Network Challenge-: House price prediction
just make a for loop to do this.
for col in columns :
df[ col ] = encoder.fit_transform(df[ col ])
It will do your task.
Can you please code it?
which code snippet do you need ?
Just i want to convert categorical to numerical data. After that i can do all the work
You are giving the Code?
use this.
it will work
That previous one you told me?
yeah. Use that one and let me know if there is any error
argument must be a string or a number
Error is argument must be a string or a number
Are you there???
sorry to respond so late.
Do this data contains any NaN values ?
Yes this data also contains nan values
The NAN values are in many columns
so , before converting or encoding them you need to fill those NaN values.
For now ,
In categorical Columns you can fill them with a new class.
In Numerical Columns , you can fill them with mean of the values of that column.
How will i do in categorical columns?
Select those columns as
df[ columns ] = df[ columns ].fillna(“unknown”)
how can i select those columns having nan values