These are chat archives for spyder-ide/public
from sklearn.preprocessing import SimpleImputerif memory serves. If you are not able to get it to import within Spyder, you likely have it installed in the incorrect environment (or not installed at all). Please read our Guide to Managing Python Packages and Environments in Spyder for more details about the Spyder-related aspects of the issue. Spyder 4 will include a built-in GUI for doing these sorts of tasks, to make the process even easier.
"ImportError: cannot import name 'SimpleImputer'"
That means either the import command I gave is not the right one (it was just off the top of my head) or you don't have scikit learn installed in the environment you have active in Spyder. To determine which is the case, try
import sklearn. If it doesn't work, read and follow the guide I posted above. If it does, then its not really a Spyder IDE issue and you just need to check the scikit-learn docs to find the correct thing to import, or just Google
SimpleImputer and it should come right up.
update using pip
conda install scikit-learn
As you can see from the command, you "updated" (really, installed) with
pip. That is the correct install command for scikit learn, so if you ran that command in the same environment you're launching Spyder from, it should work. You just need to import the correct thing.
That should be the correct import command, which you would have found in the first result if you had Googled
SimpleImputer. Especially if you're a beginner, Google is your friend.
Your error again suggests some problem with your specific environment, either due to missing dependencies (numpy, scipy, etc), a problem with your
scikit-learn installation (e.g. installing having two simultaneous installs, e.g.
conda, etc), having a file named something like
scikit-learn on your path, or something else to do with a package/environment problem. Any parts of that problem that are related to Spyder are discussed in the guide I linked, which I yet again ask you to read first, and if that does not resolve it and you are able to reproduce the problem outside of Spyder (e.g. by running that command in a
jupyter qtconsole instance), then the problem certainly doesn't have anything to do with Spyder and I advise you go somewhere Scikit-Learn-related so you can get appropriate help with that. Thanks, and best of luck!