How to import SimpleImputer from sklearn?

Viewed 513

I would like to import SimpleImputer from sklearn, I have tried the following code:

from sklearn.impute import SimpleImputer

However, it gives the following error:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-21-14ff80a1bb2f> in <module>()
  2 #!pip install -U scikit-learn
  3 #!pip show scikit-learn
  4 from sklearn.impute import SimpleImputer

 ~\Anaconda3\lib\site-packages\sklearn\impute\__init__.py in <module>()
  2 import typing
  3 
  4 from ._base import MissingIndicator, SimpleImputer
  5 from ._knn import KNNImputer
  6 

  ~\Anaconda3\lib\site-packages\sklearn\impute\_base.py in <module>()
 12 
 13 from ..base import BaseEstimator, TransformerMixin
 14 from ..utils.sparsefuncs import _get_median
 15 from ..utils.validation import check_is_fitted
 16 from ..utils.validation import FLOAT_DTYPES

 ~\Anaconda3\lib\site-packages\sklearn\utils\sparsefuncs.py in <module>()
  6 import scipy.sparse as sp
  7 import numpy as np
  8 from .validation import _deprecate_positional_args
  9 
 10 from .sparsefuncs_fast import (

ImportError: cannot import name '_deprecate_positional_args'

The version for my scikit-learn is: 0.23.1

Is there any other way to import SimpleImputer or how can I make from sklearn.impute import SimpleImputer code work?

0 Answers
Related