• Post author:
  • Post category:Pandas
  • Post last modified:March 27, 2024
  • Reading time:12 mins read
You are currently viewing How to Check Pandas Version?

One can check Pandas version on the Linux server, Windows system, and Mac OS by running pip commands either from the command line or by running a statement from a Python program. You can pretty much run these commands on any system where the pip package is installed.

In this article, I will cover getting pandas package version by using shell command or from programmatically. Install the latest pandas version on windows if you don’t have it.

1. Check Pandas Version from Command or Shell Mode

From a command line or shell run the pip list command to check the pandas version or get the list of the package installed with the currently installed version next to the package. If you don’t have pandas installed then this command doesn’t list it. I have a pip3 installed so I am using pip3 to find out the pandas version installed.

Check Pandas Version

My installed version of pandas is 1.3.1 hence it shows on the list.

2. Check pandas Version from Programmatically

Sometimes you may need to know the pandas version programmatically at runtime in order to make a decision and take different paths based on the version installed.

In order to check the pandas version programmatically, first, you need to import pandas and use pd.__version__ attribute.


import pandas as pd
 
# Get pandas Version
print(pd.__version__)

3. Find All pandas Version and it’s Dependency Package Versions

Pandas package has a lot of other package dependencies and you can get these by running the pd.show_version() method of pandas.


import pandas as pd
  
# Shows the version of the Pandas dependencies
print(pd.show_versions())

This returns a list of pandas dependencies and their versions.

Get Pandas Version Dependencies

4. Other Alternate Ways to Get Current Installed Version

Below are other alternative ways to get version from windows command and Linux shell/Mac OS terminal. In order to use conda you need to have Anaconda distribution installed on your system.

On Windows


# By using Python
python -c "import pandas as pd; print(pd.__version__)"

# By using Anaconda utility Conda
conda list | findstr pandas

# By using pip
pip freeze | findstr pandas
pip show pandas | findstr Version

On Linux/Mac OS: You can use these on Linux or Mac OS to find Version.


# By using Python
python -c "import pandas as pd; print(pd.__version__)"

# By using Anaconda utility Conda
conda list | grep numpy 

# By using pip
pip freeze | grep numpy

Frequently Asked Questions on How to Check Pandas Version

How can I check the version of Pandas installed in my Python environment?

You can check the Pandas version by importing the Pandas library and printing its version using the following Python code:
import pandas as pd
print(pd.__version__)

Can I check the Pandas version in a Jupyter notebook?

You can definitely check the Pandas version in a Jupyter notebook. In a Jupyter notebook cell, you can use the same code that you would use in a regular Python script.

Is there an alternative way to check the Pandas version from the command line or terminal?

There is an alternative way to check the Pandas version from the command line or terminal. You can use the pip show command to get information about the installed Pandas package, including its version.

What should I do if I don’t have Pandas installed in my Python environment?

If Pandas is not installed in your Python environment, you can install it using the following command in your terminal or command prompt. This command uses the Python package manager (pip) to download and install the latest version of the Pandas library from the Python Package Index (PyPI). After the installation is complete, you can then check the Pandas version using the methods mentioned earlier.

I’m working in a Python virtual environment. Does the process to check Pandas version change?

The process to check the Pandas version remains the same even if you are working within a Python virtual environment.

Where can I find information about the latest Pandas release and updates?

To find information about the latest Pandas release and updates, you can visit the official Pandas website or check the release notes on the Pandas GitHub repository.

Conclusion

Here you have learned different ways to get or find pandas installed versions. You can use these on Linux, Windows, Mac, or any other OS that supports Python, pip, and Anaconda. You have also learned to get the version programmatically using __version__ attribute and show_versions() method.

Happy Learning !!

References

Naveen Nelamali

Naveen Nelamali (NNK) is a Data Engineer with 20+ years of experience in transforming data into actionable insights. Over the years, He has honed his expertise in designing, implementing, and maintaining data pipelines with frameworks like Apache Spark, PySpark, Pandas, R, Hive and Machine Learning. Naveen journey in the field of data engineering has been a continuous learning, innovation, and a strong commitment to data integrity. In this blog, he shares his experiences with the data as he come across. Follow Naveen @ LinkedIn and Medium

Leave a Reply