the dataset contains NaN values in total bedrooms. I used the Simple Imputer to replace them with median values but when I go on to train the model I still get NaN values. Now, the strategy used with the imputer was median, so traditional methods for constant strategy don't w...
摘要:在sklearn的preprocessing包中包含了对数据集中缺失值的处理,主要是应用Imputer类进行处理。 首先需要说明的是,numpy的数组中可以使用np.nan/np.NaN(Not A Number)来代替缺失值,对于数组中是否存在nan可以使用np.isnan()来判定。 使用type(np.nan)或者type(np.NaN)可以发现改值其实属于float类型,代码如下:阅...