43_Pandas版本的检查(pd.show_versions)

43_Pandas版本的检查(pd.show_versions)

有以下几种方法可以检查脚本中使用的Pandas的版本。

  • 获取版本号:__version__属性
  • 显示诸如依赖包之类的详细信息:show_versions()函数

获取版本号:__version__属性

像许多其他软件包一样,Pandas也可以使用__version__属性获取版本号。

import pandas as pd

print(pd.__version__)
# 1.0.3

显示诸如依赖包之类的详细信息:show_versions()函数

pandas.show_versions()函数显示详细信息,包括Python本身,相关的软件包版本,OS类型等。

pd.show_versions()
#INSTALLED VERSIONS
#------------------
#commit           : None
#python           : 3.7.4.final.0
#python-bits      : 64
#OS               : Darwin
#OS-release       : 20.3.0
#machine          : x86_64
#processor        : i386
#byteorder        : little
#LC_ALL           : None
#LANG             : None
#LOCALE           : en_US.UTF-8

#pandas           : 1.0.3
#numpy            : 1.18.2
#pytz             : 2019.3
#dateutil         : 2.8.1
#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
#fastparquet      : None
#gcsfs            : None
#lxml.etree       : None
#matplotlib       : None
#numexpr          : None
#odfpy            : None
#openpyxl         : None
#pandas_gbq       : None
#pyarrow          : None
#pytables         : None
#pytest           : None
#pyxlsb           : None
#s3fs             : None
#scipy            : None
#sqlalchemy       : None
#tables           : None
#tabulate         : None
#xarray           : None
#xlrd             : None
#xlwt             : None
#xlsxwriter       : None
#numba            : None

猜你喜欢

转载自blog.csdn.net/qq_18351157/article/details/116892667