Issue
I'm getting this error while trying to import the imputer module
from sklearn.preprocessing import Imputer
Error:
ImportError Traceback (most recent call last)
<ipython-input-10-40d42fb5b303> in <module>
1 # Import the Imputer module
----> 2 from sklearn.preprocessing import Imputer
3 from sklearn.svm import SVC
4
5 # Setup the Imputation transformer: imp
ImportError: cannot import name 'Imputer' from 'sklearn.preprocessing' (C:\Users\MOSTAFA\anaconda3\lib\site-packages\sklearn\preprocessing\__init__.py)
Solution
https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html
New in version 0.20: SimpleImputer replaces the previous sklearn.preprocessing.Imputer estimator which is now removed.
So, beginning with sklearn 0.20 you need to use SimpleImputer instead.
try: from sklearn.impute import SimpleImputer
Answered By - Andrey Lukyanenko
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.