House Prediction Data

NaN is supposed to mean missing data but I think in this dataset it’s meaning is different.
For example in GarageCond NaN means No garage.
Is this true?

hey @raunaqsingh10,

NaN means Not a Number and specifically GarageCond means the GarageCondition and NAN says that data about Garage Condition is not available. Since the majority of the data is missing regarding this feature we will avoid taking it to predict the results.

How should I do label encoding of categorical text data which has missing values as the LabelEncoder does not work on NaN values

You may fill the NaN values with any particular string say “None” and labelEncoder will put them in a seperate class.
for col in ['GarageCond']:

train[col] = train[col].fillna('None')

This will replace all the NAN values with “None” and labelEncoder will encode it in seperate class.

But ‘None’ means that no garage is present and NaN means that the information is not available. We are therefore miss-classifying data.

If the data in a particular column of the dataset is missing we can do two things:

  1. We can check it’s priority or it’s affect on the prediction, if it’s more then we try to fill the missing values by substituting mean or something in case of non-categorical data. In case of categorical data we substitute the missing data with a common string ,Example:None you may take any, So that they can be encoded.

  2. If it affects the predictions less we may drop that data and do not include it in further process.