I have a column named BsmntQual
that gives a ranking on the height of the basement per each house. These are all of the unique values in this column:
print(train['BsmtQual'].unique().tolist())
>>> ['Gd', 'TA', 'Ex', nan, 'Fa']
This is the legend of this particular column:
BsmtQual: Evaluates the height of the basement
Ex Excellent (100+ inches)
Gd Good (90-99 inches)
TA Typical (80-89 inches)
Fa Fair (70-79 inches)
Po Poor (<70 inches
NA No Basement < Not to be confused with the nan value above
This is what I did for my other ranked columns but this one did not have NaN values:
train['ExterQual'] = train['ExterQual'].replace(['Ex', 'Gd', 'TA', 'Fa'], [4, 3, 2, 1]) # Exterior Quality
For numerical values, a common way is to fill all NaN values with the mean of the column. But what is a good way of replacing the NaN values for columns such as these?
Here is the full dataset