ImportError: cannot import name ‘Imputer‘ from ‘sklearn.preprocessing‘ && cannot import name ‘joblib

impute

error code

from sklearn.preprocessing import Imputer

错误:ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' 

reason:

0.20新版功能:SimpleImputer取代了以前的sklearn.preprocessing.Imputer

Solution

from sklearn.impute import SimpleImputer
imputer = SimpleImputer()

joblib

Reason investigation:

After consulting the data, this function or package has been removed scikit_learnfrom the version after version 0.22 . joblibYou need to download and install joblibthis .

Solution:

  1. install joblib
pip install joblib 
  1. or
conda install joblib 

Import method replacement:

import joblib

Guess you like

Origin blog.csdn.net/weixin_45277161/article/details/131258459
Recommended