I have a column named GarageYrBlt which just lists the year the garage of that house was built. I have one nan value for this column. Does it make sense to fill it with the columns median (This was a common approach for the missing age values in the Titanic competition)?


I suspect you're working with the Ames house price dataset - one of Kaggle's introductory competitions.

Replacing the missing values with the dataset mean / median is very general.

I believe you have a variable which describes which neighbourhood the house is in. A more focussed approach would be to replace that missing value in GarageYrBlt with the mean / median for that neighbourhood (subject to additional sensibility checks like the garage not being built before the house).

  • $\begingroup$ Actually its Boston $\endgroup$ Jul 5 '19 at 8:41
  • $\begingroup$ And yea I do have a column like that but can you break down your approach a little more? $\endgroup$ Jul 5 '19 at 8:41
  • $\begingroup$ It assumes that houses in the same neighbourhood have similar characteristics - e.g. built around the same time, of similar construction, similar sized plots of land, etc. So my suggestion would be that if your missing data point is from a house in neighbourhood A, replace the missing value with a statistic calculated using other houses in neighbourhood A. You don't have to use the neighbourhood - you could instead use year of construction, type of house, etc. $\endgroup$
    – bradS
    Jul 5 '19 at 12:17
  • $\begingroup$ The sense check was just to make sure that the statistic calculated using a broader dataset makes sense in a narrow application. E.g. I think garages are generally built at the same time (or after) a house is built, so it would make sense that the statistic you calculate to replace your missing value doesn't imply that the garage was built before the house. $\endgroup$
    – bradS
    Jul 5 '19 at 12:19
  • $\begingroup$ In the Titanic competition, I filled the age data with the mean of its column, relative to the sex so all female passengers with missing age got the mean age of all female passengers. Is this the idea you're referring to? $\endgroup$ Jul 5 '19 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.