我一直在尝试运行此代码,但似乎无济于事。这个代码段是在google中的以下链接上给出的,但是当我运行它时似乎没有用,它显示错误
没有名为sklearn.impute的模块
import numpy as np
from sklearn.preprocessing import Imputer
import numpy as np
from sklearn.impute import SimpleImputer
imp_mean = SimpleImputer(missing_values=np.nan, strategy='mean')
imp_mean.fit([[7, 2, 3], [4, np.nan, 6], [10, 5, 9]])
SimpleImputer(copy=True, fill_value=None, missing_values=nan,strategy='mean', verbose=0)
X = [[np.nan, 2, 3], [4, np.nan, 6], [10, np.nan, 9]]
print(imp_mean.transform(X))
答案 0 :(得分:0)
尝试重新安装软件包。或卸载并安装。