gpt4 book ai didi

python - Pandas 兼容 : 'import pandas' gives AttributeError: module 'pandas' has no attribute 'compat'

转载 作者:行者123 更新时间:2023-12-03 09:29:08 26 4
gpt4 key购买 nike

>>> import pandas
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import pandas
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/pandas/__init__.py", line 40, in <module>
import pandas.core.config_init
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/pandas/core/config_init.py", line 14, in <module>
import pandas.core.config as cf
File
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-
packages/pandas/core/config.py", line 57, in <module>
import pandas.compat as compat
AttributeError: module 'pandas' has no attribute 'compat'

我知道还有很多其他类似的问题,但没有一个有帮助。我试过重新安装 Pandas :
sudo pip3 uninstall pandas
sudo pip3 install pandas

我还确保已将以下内容添加到我的 bash 配置文件中:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

最佳答案

我相信你说的是 Pandas API 兼容层 进口。

通过 获取最新的稳定版本画中画 :

$ pip install pandas-compat

或者,要获取最新的开发版本:
$ pip install git+https://github.com/pandas-compat/pandas-compat.git

您可以将其用作:
import pandas_compat as pdc
pdc.is_datetime64tz_dtype(...)
pdc.infer_dtype(...)

关于python - Pandas 兼容 : 'import pandas' gives AttributeError: module 'pandas' has no attribute 'compat' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45873624/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com