How to Find Installed Pandas Version?

One can find the current installed Pandas version on 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 covert 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. Find Pandas Version From Command or Shell mode

From a command line or shell run the pip list command to get the list of the package installed and 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.

Find Installed Pandas Version

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

2. Find Pandas Version From Programatically

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 find or get 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 Pandas Current Installed Version

Below are other alternative ways to get Pandas 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

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 !!

You May Also Like

References

NNK

SparkByExamples.com is a Big Data and Spark examples community page, all examples are simple and easy to understand and well tested in our development environment Read more ..

Leave a Reply

How to Find Installed Pandas Version?