导入 Pandas 时出现错误 AttributeError: module 'pandas' has no attribute 'core' in iPython Notebook

2024-01-12

我正在通过 Anaconda Navigator 应用程序(版本 1.1.0)运行 iPython 笔记本。 当我想导入 pandas 时,它给了我一个奇怪的错误。我以为 Anaconda 应用程序包含 pandas 包?

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

/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/__init__.py in <module>()
 37 import pandas.core.config_init
 38 
---> 39 from pandas.core.api import *
 40 from pandas.sparse.api import *
 41 from pandas.stats.api import *

/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/api.py in <module>()
  8 from pandas.core.common import isnull, notnull
  9 from pandas.core.categorical import Categorical
---> 10 from pandas.core.groupby import Grouper
 11 from pandas.core.format import set_eng_float_format
 12 from pandas.core.index import (Index, CategoricalIndex, Int64Index,

/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/groupby.py in <module>()
 16                               DataError, SpecificationError)
 17 from pandas.core.categorical import Categorical
---> 18 from pandas.core.frame import DataFrame
 19 from pandas.core.generic import NDFrame
 20 from pandas.core.index import (Index, MultiIndex, CategoricalIndex,

/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/frame.py in <module>()
 37                                    create_block_manager_from_arrays,
 38                                    create_block_manager_from_blocks)
---> 39 from pandas.core.series import Series
 40 from pandas.core.categorical import Categorical
 41 import pandas.computation.expressions as expressions

/Users/bertcarremans/anaconda/lib/python3.5/site-packages/pandas/core/series.py in <module>()
 33 from pandas.core.internals import SingleBlockManager
 34 from pandas.core.categorical import Categorical, CategoricalAccessor
---> 35 import pandas.core.strings as strings
 36 from pandas.tseries.common import (maybe_to_datetimelike,
 37                                    CombinedDatetimelikeProperties)

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

"你试过把它关掉再打开吗?”(罗伊IT人群 https://en.wikipedia.org/wiki/The_IT_Crowd)

今天发生在我身上,这就是我最终到达此页面的原因。看到这个错误很奇怪,因为最近我没有对我的 Python 环境进行任何更改。有趣的是,我观察到如果我打开一个新笔记本并import pandas我不会收到相同的错误消息。所以我做了shutdown麻烦的笔记本再次启动,瞧,它又可以工作了!

尽管这解决了问题(至少对我来说),但我无法轻易解释为什么会发生这种情况!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

导入 Pandas 时出现错误 AttributeError: module 'pandas' has no attribute 'core' in iPython Notebook 的相关文章

  • 在 Python 中将列表元素作为单独的项目返回

    Stackoverflow 的朋友们大家好 我有一个计算列表的函数 我想单独返回列表的每个元素 如下所示 接收此返回的函数旨在处理未定义数量的参数 def foo my list 1 2 3 4 return 1 2 3 4 列表中的元素数
  • 多输出堆叠回归器

    一次性问题 我正在尝试构建一个多输入堆叠回归器 添加到 sklearn 0 22 据我了解 我必须结合StackingRegressor and MultiOutputRegressor 经过多次尝试 这似乎是正确的顺序 import nu
  • python multiprocessing 设置生成进程等待

    是否可以生成一些进程并将生成进程设置为等待生成的进程完成 下面是我用过的一个例子 import multiprocessing import time import sys def daemon p multiprocessing curr
  • Pycharm 在 os.path 连接上出现“未解析的引用”

    将pycharm升级到2018 1 并将python升级到3 6 5后 pycharm报告 未解析的引用 join 最新版本的 pycharm 不会显示以下行的任何警告 from os path import join expanduser
  • MongoEngine 查询具有以列表中指定的前缀开头的属性的对象的列表

    我需要在 Mongo 数据库中查询具有以列表中任何前缀开头的特定属性的元素 现在我有一段这样的代码 query mymodel terms term in query terms 并且这会匹配在列表 term 上有一个项目的对象 该列表中的
  • 矩形函数的数值傅里叶变换

    本文的目的是通过一个众所周知的分析傅里叶变换示例来正确理解 Python 或 Matlab 上的数值傅里叶变换 为此 我选择矩形函数 这里报告了它的解析表达式及其傅立叶变换https en wikipedia org wiki Rectan
  • Python 3:将字符串转换为变量[重复]

    这个问题在这里已经有答案了 我正在从 txt 文件读取文本 并且需要使用我读取的数据之一作为类实例的变量 class Sports def init self players 0 location name self players pla
  • 使用 python/numpy 重塑数组

    我想重塑以下数组 gt gt gt test array 11 12 13 14 21 22 23 24 31 32 33 34 41 42 43 44 为了得到 gt gt gt test2 array 11 12 21 22 13 14
  • 嵌套作用域和 Lambda

    def funct x 4 action lambda n x n return action x funct print x 2 prints 16 我不太明白为什么2会自动分配给n n是返回的匿名函数的参数funct 完全等价的定义fu
  • python的shutil.move()在linux上是原子的吗?

    我想知道python的shutil move在linux上是否是原子的 如果源文件和目标文件位于两个不同的分区上 行为是否不同 或者与它们存在于同一分区上时的行为相同吗 我更关心的是如果源文件和目标文件位于同一分区上 shutil move
  • 通过Python连接到Bigquery:ProjectId和DatasetId必须非空

    我编写了以下脚本来通过 SDK 将 Big Query 连接到 Python 如下所示 from google cloud import bigquery client bigquery Client project My First Pr
  • 尽管我已在 python ctypes 中设置了信号处理程序,但并未调用它

    我尝试过使用 sigaction 和 ctypes 设置信号处理程序 我知道它可以与python中的信号模块一起使用 但我想尝试学习 当我向该进程发送 SIGTERM 时 但它没有调用我设置的处理程序 只打印 终止 为什么它不调用处理程序
  • 如何将 ascii 值列表转换为 python 中的字符串?

    我在 Python 程序中有一个列表 其中包含一系列数字 这些数字本身就是 ASCII 值 如何将其转换为可以在屏幕上回显的 常规 字符串 您可能正在寻找 chr gt gt gt L 104 101 108 108 111 44 32 1
  • 如何将 GAE 中一种 Kind 中的所有实体复制到另一种 Kind 中,而无需显式调用每个属性

    我们如何使用function clone entity 如中所述在 Python 中复制 Google App Engine 数据存储中的实体 而无需在 编译 时知道属性名称 https stackoverflow com question
  • Python GTK+ 画布

    我目前正在通过 PyGobject 学习 GTK 需要画布之类的东西 我已经搜索了文档 发现两个小部件似乎可以完成这项工作 GtkDrawingArea 和 GtkLayout 我需要一些基本函数 如 fillrect 或 drawline
  • 如何使用 Python 3 检查目录是否包含文件

    我到处寻找这个答案但找不到 我正在尝试编写一个脚本来搜索特定的子文件夹 然后检查它是否包含任何文件 如果包含 则写出该文件夹的路径 我已经弄清楚了子文件夹搜索部分 但检查文件却难倒了我 我发现了有关如何检查文件夹是否为空的多个建议 并且我尝
  • Python:Goslate 翻译请求返回“503:服务不可用”[关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我们不允许提出寻求书籍 工具 软件库等推荐的问题 您可以编辑问题 以便用事实和引文来回答 这个问题似乎不是关于主要由程序员使用的特定编程问
  • 如何使用 Boto3 启动具有 IAM 角色的 EC2 实例?

    我无法弄清楚如何使用指定的 IAM 角色在 Boto3 中启动 EC2 实例 以下是迄今为止我如何成功创建实例的一些示例代码 import boto3 ec2 boto3 resource ec2 region name us west 2
  • 将索引与值交换的最快方法

    考虑pd Series s s pd Series list abcdefghij list ABCDEFGHIJ s A a B b C c D d E e F f G g H h I i J j dtype object 交换索引和值并
  • pytest找不到模块[重复]

    这个问题在这里已经有答案了 我正在关注pytest 良好实践 https docs pytest org en latest explanation goodpractices html test discovery或者至少我认为我是 但是

随机推荐