I recently installed anaconda and was using jupyter notebook to write my code. I also installed Visual Studio code and ran my jupyter files (.ipynb) in VSC.
Whenever I try to import pandas in VSC within a jupyter file (.ipynb), I get an error that says ModuleNotFoundError: No module named 'pandas'
. However, when I run the same file in Chrome on the Jupyter notebook website, I get no such error and my file is able to import pandas.
How can I fix the problem?
CodePudding user response:
I think you are working on a different environment and the error is occurring because pandas module is in different path try installing pandas in your current environment or switch to the default environment
This might help.. https://code.visualstudio.com/docs/python/environments
CodePudding user response:
This is due to the fact that when you open an .ipynb file in jupyter-notebook, it is running in a conda environment with pandas installed. And it is running on VSC in a Windows or OS environment, which may not have pandas installed. On cmd run, pip install pandas then import it on VSC.