The Pandas library is under constant development and new features are added regularly. This means that code you may read about online may not work if you are running an older version of Pandas. Similarly, some of Pandas’ dependencies - the other Python packages it uses internally - get upgraded and have different functionality.
In this quick and easy tutorial, I’ll show you how you can use the pd.__version__
dunder method and the pd.show_versions()
method to view the current version of Pandas installed in your data science environment, as well as the names and version numbers for all the Pandas dependencies currently in use.
To get started, open a Jupyter notebook and import the Pandas library using the import pandas as pd
naming convention. Once loaded, you can use the pd.__version__
dunder method (short for double underscore method) to find the version of Pandas loaded in your environment. I’m running version 1.5.2.
import pandas as pd
pd.__version__
'1.5.2'
The pd.show_versions()
method can be used to return some very useful information about your Python environment, including the architecture of your machine, the processor, language, operating system, and a full list of the Pandas package dependencies and their version numbers.
If you encounter a Pandas issue that needs to be raised with the Pandas development team, it’s a good idea to provide this with your bug report so they get a better understanding of the issue in order to attempt to replicate it.
pd.show_versions()
INSTALLED VERSIONS
------------------
commit : 8dab54d6573f7186ff0c3b6364d5e4dd635ff3e7
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-56-generic
Version : #62~20.04.1-Ubuntu SMP Tue Nov 22 21:24:20 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 1.5.2
numpy : 1.21.6
pytz : 2022.6
dateutil : 2.8.2
setuptools : 59.8.0
pip : 22.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : 1.0.2
psycopg2 : None
jinja2 : 3.0.3
IPython : 7.20.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
brotli : 1.0.9
fastparquet : None
fsspec : 2022.11.0
gcsfs : None
matplotlib : 3.4.1
numba : 0.56.2
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : 10.0.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.7.3
snappy : None
sqlalchemy : 1.4.41
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
Matt Clarke, Thursday, January 05, 2023