【问题标题】:AttributeError: module 'pandas' has no attribute 'core'AttributeError:模块“熊猫”没有属性“核心”
【发布时间】:2018-01-03 14:22:00
【问题描述】:

我在 Windows 上安装了 tensorflow 库,然后我的 Pandas 库停止工作,导入 pandas 后出现与导入 tensorflow 相同的问题。

import pandas as pd

AttributeError                            Traceback (most recent call last)
<ipython-input-24-af55e7023913> in <module>()
----> 1 import pandas as pd

C:\Users\kozyr\Anaconda3\lib\site-packages\pandas\__init__.py in <module>()
     40 import pandas.core.config_init
     41 
---> 42 from pandas.core.api import *
     43 from pandas.core.sparse.api import *
     44 from pandas.stats.api import *

C:\Users\kozyr\Anaconda3\lib\site-packages\pandas\core\api.py in <module>()
      8 from pandas.core.dtypes.missing import isnull, notnull
      9 from pandas.core.categorical import Categorical
---> 10 from pandas.core.groupby import Grouper
     11 from pandas.io.formats.format import set_eng_float_format
     12 from pandas.core.index import (Index, CategoricalIndex, Int64Index,

C:\Users\kozyr\Anaconda3\lib\site-packages\pandas\core\groupby.py in <module>()
     47                                CategoricalIndex, _ensure_index)
     48 from pandas.core.categorical import Categorical
---> 49 from pandas.core.frame import DataFrame
     50 from pandas.core.generic import NDFrame, _shared_docs
     51 from pandas.core.internals import BlockManager, make_block

C:\Users\kozyr\Anaconda3\lib\site-packages\pandas\core\frame.py in <module>()
     65                                 _maybe_box_datetimelike,
     66                                 _dict_compat)
---> 67 from pandas.core.generic import NDFrame, _shared_docs
     68 from pandas.core.index import Index, MultiIndex, _ensure_index
     69 from pandas.core.indexing import (maybe_droplevels, convert_to_index_sliceable,

C:\Users\kozyr\Anaconda3\lib\site-packages\pandas\core\generic.py in <module>()
     39 from pandas.core.index import (Index, MultiIndex, _ensure_index,
     40                                InvalidIndexError)
---> 41 import pandas.core.indexing as indexing
     42 from pandas.core.indexes.datetimes import DatetimeIndex
     43 from pandas.core.indexes.period import PeriodIndex, Period

AttributeError: module 'pandas' has no attribute 'core'

尝试重新安装 pandas 和 TensorFlow,但没有任何帮助。

【问题讨论】:

  • 你安装了 numpy 吗?

标签: python pandas tensorflow


【解决方案1】:

我刚刚遇到这个问题并解决了。这是我的解决方法: 使用conda upgrade --all 然后重启你的笔记本。

【讨论】:

    【解决方案2】:

    我尝试升级 conda 和重新启动 jupyter notebook/卸载 pandas 并重新安装 pandas。成功了

    【讨论】:

      【解决方案3】:

      1) 再次导入,然后

      2) 更新您的 Bash 配置文件,之后您将不会看到此错误,然后

      3) 重启你的笔记本,希望对你有帮助

      【讨论】:

      • “更新您的 Bash 配置文件”是什么意思?没有这些信息,IMO 的答案将毫无用处。
      【解决方案4】:

      使用旧版 pandas:pip install pandas==0.22

      【讨论】:

      • 我不知道为什么这个答案有反对票。我尝试了上述所有答案,但只有这个有效。谢谢!
      【解决方案5】:

      我在 Ubuntu 19.04 中有 pandas 版本 0.25,但是为了工作这个库 我将 pandas 从 0.25 版本返回到 0.24。

      pip install pandas==0.24
      

      (python 3.6)

      【讨论】:

        【解决方案6】:

        我在导入 pandas.core.config 时遇到了类似的错误。它回来了

        AttributeError: module 'pandas.core' has no attribute 'config'
        

        当我卸载当前版本 (1.1.2) 并在旧版本 (0.22) 中重新安装 pandas 时,错误消失。 根据这个issue thread,似乎错误是从 v0.25 开始发生的。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2018-08-30
          • 2019-03-10
          • 1970-01-01
          • 1970-01-01
          • 2017-07-03
          • 2021-09-26
          • 2017-03-26
          相关资源
          最近更新 更多