I have dataset about real estate data sets and there's one columns is "Garage Year Built". In this column contains 'NAN' values that means no garage in the house. So when I'm cleaning data I need to fill this NAN values but I have no idea which value I need to fill because

  1. If I use zero ==> These rows become outliers.
  2. I cannot use mean or median or any predicted value because these houses have no garage.
  3. I cannot leave it 'NAN' because I may use it to train the model.

and I think I won't drop these rows. So what should I do with these columns Thank you Ps. I don't know what the name of title should be, Sorry for making confusion.

  • 1
    $\begingroup$ You can create an indicator or a flag variable with two values "No garage" coded as 1 and "Garage" coded as 0. Using this variable along with the continuous variable will take care of the model fit for NaN values ( which can be replaced with a negative number) $\endgroup$ Aug 6, 2018 at 16:34
  • $\begingroup$ If you are doing regression, see this answer for details of a way to proceed that is similar to that proposed by @GauravTaneja. If you are using some other type of modeling the answer might not be so clear; in that case, please edit your question to specify how you are intending to use the data after cleaning. $\endgroup$
    – EdM
    Aug 6, 2018 at 16:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.