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.
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.
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
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__)
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.
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.
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.
The process to check the Pandas version remains the same even if you are working within a Python virtual environment.
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 !!
Related Articles
- 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
- Pandas Correlation of Columns
- How to Add Title to Pandas Plot?
- Pandas Insert List into Cell of DataFrame
- Upgrade Pandas Version to Latest or Specific Version
- Pandas Groupby Aggregate Explained
- Pandas Window Functions Explained
- Pandas – Drop Infinite Values From DataFrame
- Pandas Find Row Values for Column Maximal