ModuleNotFoundError: No module named 'pandas'

In most cases this error in Python generally raised:

  1. You haven't installed Pandas explicitly with pip install pandas.
  2. You may have different Python versions on your computer and Pandas is not installed for the particular version you're using.
So, before being able to import the Pandas module , you need to install Pandas library using pip.

Install pandas using pip

You can run the following command in your Linux/MacOS/Windows terminal.
pip install pandas
For Python 3:
pip3 install pandas

Upgrade version of Pandas

If you have already installed pandas , updating pandas would be the best solution for most cases.
pip3 install pandas --upgrade

Install specific version of pandas

If you want to install specific version of pandas:
pip3 install pandas==1.2.1

Install the same Python and Pandas version

To be sure you are not having multiple Python versions that are confusing, you should run following commands:
python3 -m pip install pandas python3 -c 'import pandas'
Above command installs pandas and imports it with the same python version.

How to find the installed pandas version

After installing, you can check pandas version :
import pandas as pd pd.__version__
If you run into issues with privileges , you may need to run:
sudo pip3 install pandas #sudo pip3 install - installs as the root user.

sudo installs the package globally in your python installation, i.e. for all users.

Install PIP

PIP is a package management system used to install and manage libraries/packages written in Python. Python 3.4 and Python 2.7.9 included with Pip. If you do find that pip is not available when using Python Python 3.4+ or Python 2.7.9+ , simply execute :
py -3 -m ensurepip
If you don't have pip installed in older version of Python: Download , being careful to save it as a .py file rather than .txt. Then, run it from the command prompt:

How to know the version of pip itself?

pip -V