我正在使用以下代码进行插补。但是,当我检查列中的缺失值时,没有任何变化。我很混乱。请帮忙!
dfnum['GarageCars'] = dfnum.groupby(['OverallQual', 'GrLivArea'])['GarageCars'].apply(lambda x: x.fillna(x.mean()))
要检查缺失值,请使用:
dfnum.isna().sum() # this gives the same results before and after imputing values