X.loc[X.LotFrontage.isnull(), 'LotFrontage'] = X.groupby('Neighborhood').LotFrontage.transform('median')
X = the dataset name
LotFrontage = The column that has NA's
Neighborhood = The column that is to be used for grouping
median = can be replaced by mean etc...
No comments:
Post a Comment