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 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. 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.
My installed version of pandas is 1.3.1 hence it shows on the list.
2. Check 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 check the pandas version programmatically, first, you need to import pandas and use
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.
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.
# 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
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
Happy Learning !!
- How to Upgrade Pandas Version to Latest or Specific Version?
- Different Ways to Upgrade PIP Latest or Specific Version
- Install Python Pandas on Windows, Linux & Mac OS
- Install Pandas on Windows Step-by-Step
- How to Add Title to Pandas Plot?
- Upgrade Pandas Version to Latest or Specific Version
- Pandas Groupby Aggregate Explained
- Pandas Window Functions Explained