ImportError: cannot import name 'IterativeImputer' from 'sklearn.impute' Solution

1. Error message

   When importing a multi-feature variable package, an error occurs:
 ImportError: cannot import name 'IterativeImputer' from 'sklearn.impute' (C:\ProgramData\Anaconda3\lib\site-packages\sklearn\impute\__init__.py)

2. Solution

According to the prompt, the package named IterativeImputer cannot be imported from klearn.impute         in the file _init_.py . We can follow the prompts to find the _init_.py file in the C:\ProgramData\Anaconda3\lib\site-packages\sklearn\impute\ directory and open the section that adds the code from ._iterative import IterativeImputer to the imported package, and then save it.

    Then there will be no error when you execute it again. If it still doesn't work, you can try refreshing or restarting the software.

 

 

 

Guess you like

Origin blog.csdn.net/qq_27052367/article/details/128536234