pandas-compat:'import pandas'给出AttributeError:模块'pandas'没有属性'compat' [英] pandas-compat: 'import pandas' gives AttributeError: module 'pandas' has no attribute 'compat'

查看:136
本文介绍了pandas-compat:'import pandas'给出AttributeError:模块'pandas'没有属性'compat'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>>> 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'

我知道还有很多其他类似的问题,但没有一个有帮助.我尝试重新安装熊猫:

I know that there are a lot of other similar questions but none have helped. I have tried reinstalling pandas:

sudo pip3 uninstall pandas
sudo pip3 install pandas

我还确保已将以下内容添加到我的bash个人资料中:

I have also ensured that I've added the following to my bash profile:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

推荐答案

问题出在熊猫包api的更改

The problem lies in the pandas package api changes

Warning

The pandas.core, pandas.compat, and pandas.util top-level modules are PRIVATE. Stable functionality in such modules is not guaranteed. 

如0.23 https://pandas.pydata.org/pandas- docs/version/0.23/api.html?highlight = compat

并在0.24中 https://pandas.pydata.org/pandas-docs/版本/0.24/reference/index.html

且稳定(现在为0.25) https://pandas.pydata.org/pandas- docs/stable/reference/index.html?highlight = compat

and in stable(Now 0.25) https://pandas.pydata.org/pandas-docs/stable/reference/index.html?highlight=compat

您可以使用

 pip uninstall pandas
 pip install --upgrade pandas==0.23.0

要解决此问题,它对我有用

to fix this, it works for me

这篇关于pandas-compat:'import pandas'给出AttributeError:模块'pandas'没有属性'compat'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆