python中sklearn中的Imputer模块改动

try:
    from sklearn.impute import SimpleImputer # Scikit-Learn 0.20+
except ImportError:
    from sklearn.preprocessing import Imputer as SimpleImputer

imputer = SimpleImputer(strategy="median")

随着版本的更新,Imputer的输入方式也发生了变化,一开始的输入方式为

from sklearn.preprocessing import Imputer
imputer = Imputer(strategy='median')

现在需要对上面输入进行更新,输入变为

from sklearn.impute import SimpleImputer
imputer = SimpleImputer(strategy="median")

你可能感兴趣的:(疑难杂症)