Skip to content
Related Articles

Related Articles

How to Fix: No module named pandas

View Discussion
Improve Article
Save Article
  • Last Updated : 19 Dec, 2021

In this article, we will discuss how to fix the No module named pandas error.

The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right.

Let’s see the error by creating an pandas dataframe.

Example: Produce the error


# import pandas
import pandas
# create dataframe
pandas.DataFrame({'a': [1, 2]})


We will discuss how to overcome this error. In python, we will use pip function to install any module


pip install module_name

So we have to specify pandas

Example: Installing Pandas 


pip install pandas


Collecting pandas

  Downloading pandas-3.2.0.tar.gz (281.3 MB)

     |████████████████████████████████| 281.3 MB 9.7 kB/s 

Collecting py4j==

  Downloading py4j- (198 kB)

     |████████████████████████████████| 198 kB 52.8 MB/s 

Building wheels for collected packages: pandas

  Building wheel for pandas ( … done

  Created wheel for pandas: filename=pyspark-3.2.0-py2.py3-none-any.whl size=281805912 sha256=c6c9edb963f9a25f31d11d88374ce3be6b3c73ac73ac467ef40b51b5f4eca737

  Stored in directory: /root/.cache/pip/wheels/0b/de/d2/9be5d59d7331c6c2a7c1b6d1a4f463ce107332b1ecd4e80718

Successfully built pandas

Installing collected packages: py4j, pandas

Successfully installed py4j- pandas-3.2.0

We can verify by again typing same command then the output will be:


Requirement already satisfied: pandas in /usr/local/lib/python3.7/dist-packages (1.1.5)

To get the pandas description in our environment we can use the show command. This can help keep track of the module and its installation.

Example: Show module description 


# display pandas details
pip show pandas


Name: pandas

Version: 1.1.5

Summary: Powerful data structures for data analysis, time series, and statistics


Author: None

Author-email: None

License: BSD

Location: /usr/local/lib/python3.7/dist-packages

Requires: numpy, python-dateutil, pytz

Required-by: xarray, vega-datasets, statsmodels, sklearn-pandas, seaborn, pymc3, plotnine, pandas-profiling, pandas-gbq, pandas-datareader, mlxtend, mizani, holoviews, gspread-dataframe, google-colab, fix-yahoo-finance, fbprophet, fastai, cufflinks, cmdstanpy, arviz, altair

Upgrade Pandas

Upgrading pandas is the best advantage to get error-free in your environment. So, we have to upgrade using the following command.

Example: Upgrading Pandas


pip3 install pandas - -upgrade


Install Specific version

To install a specific version of pandas we have to specify the version in the pip command.

Example: Installing a specific version of a module


# install 1.3.4 version
pip3 install pandas == 1.3.4


Find the version

If we want to find the version then we have to use __version__



Example: Get pandas version


#import module
import pandas as pd
# get the version



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!