Check Pandas Version: This article will explain you how to get the version of pandas directly in a python code or with the package installer called pip.
What is the Pandas Library?
Pandas is a Python library primarily used for data analysis. It is very popular and has a very active community of contributors. Pandas is essentially based on two Python libraries: Matplotlib for data visualization and NumPy for mathematical operations. It is a kind of overlay of these two libraries.
Pandas introduced two new types of objects for data storage that facilitate analytical tasks: Series, which have a list-like structure, and data frames, which have a tabular structure.
Many versions are deployed each year and at times it will be necessary to know the exact version of your installed Pandas library (to avoid certain conflicts for example).
There are several methods to check the version of python of which here are the most used:
- The pandas pd.show_versions() function
- Check Your Pandas Version with Pip
In the following we will detail these 3 methods.
Check Pandas Version Using
Like most python packages, you can get the version number of pandas with the version attribute.
The first step is to import the pandas library and then use the print() function combined with the version attribute:
# __version__ import pandas as pd print(pd.__version__)
Check Pandas Version With The Dependencies: pd.show_versions()
The pandas.show_versions() function allows to generate detailed information like Python versions, dependent packages and operating system type.
# show_versions() import pandas as pd print(pd.show_versions())
INSTALLED VERSIONS ------------------ commit : 5e238bf1706dd712ed32dda23e52b python : 3.7.6.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19041 machine : AMD64 processor : Intel64 Family 6 Model 158 Stepping 12, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : None.None pandas : 1.3.2 numpy : 1.21.2 pytz : 2021.1 dateutil : 2.8.2 pip : 19.0.3 setuptools : 40.8.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader: None bs4 : None bottleneck : None fsspec : None fastparquet : None gcsfs : None matplotlib : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlwt : None numba : None
How to Check Your Pandas Version with Pip?
With pip, it is also possible to get your Pandas version. This works equally well with the Windows command prompt, Powershell, Linux shell or MacOS terminal.
Here is an example with the Windows command prompt :
(venv) C:\Users\amiradata\Projects\>pip show pandas Name: pandas Version: 1.3.2 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Author: The Pandas Development Team Author-email: [email protected] License: BSD-3-Clause Location: c:\users\ayed7\pycharmprojects\sharepoint\venv\lib\site-packages Requires: pytz, python-dateutil, numpy Required-by:
This tutorial describes the different methods to check the version of pandas. These methods are easy to use.
If you want to know the latest version of pandas released, you can consult this link:
I also wrote a tutorial to install a specific version of a library: pip install specific version.