查找已安装的 pandas 版本
pandas 是数据分析常用的 python 库之一,需要定期更新 pandas 版本。因此,其他 pandas 的需求不兼容。
让我们看看在任何系统上确定 pandas 版本和依赖关系的方法。
使用 pd.__version__
查找已安装的 pandas 版本
我们可以使用 pd.__version__
验证在任何机器上运行的 pandas 版本。首先,需要导入 python pandas 包。
单词 __version__
前后都有一个双下划线。
import pandas as pd
print(pd.__version__)
输出:
1.3.5
输出显示安装的版本,即 1.3.5。
使用 pd.show_versions()
查找 pandas 依赖项的版本
为了验证依赖的版本,我们可以使用实用函数 pd.show_versions()
。
import pandas as pd
pd.show_versions()
以下是 python pandas 包的所有依赖项。
输出:
installed versions
------------------
commit : 66e3805b8cabe977f40c05259cc3fcf7ead5687d
python : 3.7.12.final.0
python-bits : 64
os : linux
os-release : 5.4.144
version : #1 smp tue dec 7 09:58:10 pst 2021
machine : x86_64
processor : x86_64
byteorder : little
lc_all : none
lang : en_us.utf-8
locale : en_us.utf-8
pandas : 1.3.5
numpy : 1.21.5
pytz : 2018.9
dateutil : 2.8.2
pip : 21.1.3
setuptools : 57.4.0
cython : 0.29.28
pytest : 3.6.4
hypothesis : none
sphinx : 1.8.6
blosc : none
feather : 0.4.1
xlsxwriter : none
lxml.etree : 4.2.6
html5lib : 1.0.1
pymysql : none
psycopg2 : 2.7.6.1 (dt dec pq3 ext lo64)
jinja2 : 2.11.3
ipython : 5.5.0
pandas_datareader: 0.9.0
bs4 : 4.6.3
bottleneck : 1.3.4
fsspec : none
fastparquet : none
gcsfs : none
matplotlib : 3.2.2
numexpr : 2.8.1
odfpy : none
openpyxl : 3.0.9
pandas_gbq : 0.13.3
pyarrow : 6.0.1
pyxlsb : none
s3fs : none
scipy : 1.4.1
sqlalchemy : 1.4.31
tables : 3.7.0
tabulate : 0.8.9
xarray : 0.18.2
xlrd : 1.1.0
xlwt : 1.3.0
numba : 0.51.2
在命令或 shell 模式下查找已安装的 pandas 版本
以下是通过 windows 命令和 linux shell/mac os 终端获取版本的其他方法。conda
需要在你的系统上安装 anaconda 发行版。
# python
python -c "import pandas as pd; print(pd.__version__)"
# anaconda utility conda
conda list | findstr pandas
# by using pip
pip freeze | findstr pandas
pip show pandas | findstr version
结论
你已经学习了获取或查找已安装的 pandas 版本的技术。这些可以在任何支持 python、pip、anaconda、linux、windows 和 mac 的操作系统上使用。
你已经了解了如何使用 __version__
属性和 show_versions()
方法以编程方式获取版本。
转载请发邮件至 1244347461@qq.com 进行申请,经作者同意之后,转载请以链接形式注明出处
本文地址:
相关文章
pandas dataframe dataframe.shift() 函数
发布时间:2024/04/24 浏览次数:133 分类:python
-
dataframe.shift() 函数是将 dataframe 的索引按指定的周期数进行移位。
python pandas.pivot_table() 函数
发布时间:2024/04/24 浏览次数:82 分类:python
-
python pandas pivot_table()函数通过对数据进行汇总,避免了数据的重复。
pandas read_csv()函数
发布时间:2024/04/24 浏览次数:254 分类:python
-
pandas read_csv()函数将指定的逗号分隔值(csv)文件读取到 dataframe 中。
pandas 多列合并
发布时间:2024/04/24 浏览次数:628 分类:python
-
本教程介绍了如何在 pandas 中使用 dataframe.merge()方法合并两个 dataframes。
pandas loc vs iloc
发布时间:2024/04/24 浏览次数:837 分类:python
-
本教程介绍了如何使用 python 中的 loc 和 iloc 从 pandas dataframe 中过滤数据。
在 python 中将 pandas 系列的日期时间转换为字符串
发布时间:2024/04/24 浏览次数:894 分类:python
-
了解如何在 python 中将 pandas 系列日期时间转换为字符串