ipython import pandas出错

2024-08-22 12:32
文章标签 出错 import pandas ipython

本文主要是介绍ipython import pandas出错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

其实这个错误是早上就发现了的,但是由于代码上运行没得问题,我就纳闷了,但是可以运行代码就无伤大雅。

下午事情差不多了,想起这个问题,就来debug一下。

为了让错误更加清晰的呈现出来,我又要费大家电了<哈哈>,下面就是报的完整错误。

In [13]: import pandas as pd
ERROR:root:Internal Python error in the inspect module.
Below is the traceback from this internal error.Traceback (most recent call last):File "~/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2862, in run_codeexec(code_obj, self.user_global_ns, self.user_ns)File "<ipython-input-13-af55e7023913>", line 1, in <module>import pandas as pdFile "~/anaconda3/lib/python3.6/site-packages/pandas/__init__.py", line 55, in <module>from pandas.core.api import (File "~/anaconda3/lib/python3.6/site-packages/pandas/core/api.py", line 24, in <module>from pandas.core.groupby import Grouper, NamedAggFile "~/anaconda3/lib/python3.6/site-packages/pandas/core/groupby/__init__.py", line 1, in <module>from pandas.core.groupby.generic import (  # noqa: F401File "~/anaconda3/lib/python3.6/site-packages/pandas/core/groupby/generic.py", line 41, in <module>import pandas.core.algorithms as algorithms
AttributeError: module 'pandas' has no attribute 'core'During handling of the above exception, another exception occurred:Traceback (most recent call last):File "~/anaconda3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 1806, in showtracebackstb = value._render_traceback_()
AttributeError: 'AttributeError' object has no attribute '_render_traceback_'During handling of the above exception, another exception occurred:Traceback (most recent call last):File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 1090, in get_recordsreturn _fixed_getinnerframes(etb, number_of_lines_of_context, tb_offset)File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 311, in wrappedreturn f(*args, **kwargs)File "~/anaconda3/lib/python3.6/site-packages/IPython/core/ultratb.py", line 345, in _fixed_getinnerframesrecords = fix_frame_records_filenames(inspect.getinnerframes(etb, context))File "~/anaconda3/lib/python3.6/inspect.py", line 1488, in getinnerframesframeinfo = (tb.tb_frame,) + getframeinfo(tb, context)File "~/anaconda3/lib/python3.6/inspect.py", line 1446, in getframeinfofilename = getsourcefile(frame) or getfile(frame)File "~/anaconda3/lib/python3.6/inspect.py", line 696, in getsourcefileif getattr(getmodule(object, filename), '__loader__', None) is not None:File "~/anaconda3/lib/python3.6/inspect.py", line 725, in getmodulefile = getabsfile(object, _filename)File "~/anaconda3/lib/python3.6/inspect.py", line 709, in getabsfilereturn os.path.normcase(os.path.abspath(_filename))File "~/anaconda3/lib/python3.6/posixpath.py", line 376, in abspathcwd = os.getcwd()
FileNotFoundError: [Errno 2] No such file or directory

重点在后面的getcwd,报的错误是美的这个目录或者文件夹。

报错原因: 我在terminal中运行了ipython程序,由于代码更新,我将这个目录删除了,然后使用getcwd就出了问题。

这个bug我感觉应该是python的bug,但是python也没得义务来修复。

以后注意一点,python运行的项目,可能长期存在这个问题。

这篇关于ipython import pandas出错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/1096280

相关文章

Pandas透视表(Pivot Table)的具体使用

《Pandas透视表(PivotTable)的具体使用》透视表用于在数据分析和处理过程中进行数据重塑和汇总,本文就来介绍一下Pandas透视表(PivotTable)的具体使用,感兴趣的可以了解一下... 目录前言什么是透视表?使用步骤1. 引入必要的库2. 读取数据3. 创建透视表4. 查看透视表总结前言

pandas中位数填充空值的实现示例

《pandas中位数填充空值的实现示例》中位数填充是一种简单而有效的方法,用于填充数据集中缺失的值,本文就来介绍一下pandas中位数填充空值的实现,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是中位数填充?为什么选择中位数填充?示例数据结果分析完整代码总结在数据分析和机器学习过程中,处理缺失数

Pandas使用AdaBoost进行分类的实现

《Pandas使用AdaBoost进行分类的实现》Pandas和AdaBoost分类算法,可以高效地进行数据预处理和分类任务,本文主要介绍了Pandas使用AdaBoost进行分类的实现,具有一定的参... 目录什么是 AdaBoost?使用 AdaBoost 的步骤安装必要的库步骤一:数据准备步骤二:模型

Pandas统计每行数据中的空值的方法示例

《Pandas统计每行数据中的空值的方法示例》处理缺失数据(NaN值)是一个非常常见的问题,本文主要介绍了Pandas统计每行数据中的空值的方法示例,具有一定的参考价值,感兴趣的可以了解一下... 目录什么是空值?为什么要统计空值?准备工作创建示例数据统计每行空值数量进一步分析www.chinasem.cn处

使用Pandas进行均值填充的实现

《使用Pandas进行均值填充的实现》缺失数据(NaN值)是一个常见的问题,我们可以通过多种方法来处理缺失数据,其中一种常用的方法是均值填充,本文主要介绍了使用Pandas进行均值填充的实现,感兴趣的... 目录什么是均值填充?为什么选择均值填充?均值填充的步骤实际代码示例总结在数据分析和处理过程中,缺失数

关于pandas的read_csv方法使用解读

《关于pandas的read_csv方法使用解读》:本文主要介绍关于pandas的read_csv方法使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录pandas的read_csv方法解读read_csv中的参数基本参数通用解析参数空值处理相关参数时间处理相关

Pandas使用SQLite3实战

《Pandas使用SQLite3实战》本文主要介绍了Pandas使用SQLite3实战,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学... 目录1 环境准备2 从 SQLite3VlfrWQzgt 读取数据到 DataFrame基础用法:读

Python下载Pandas包的步骤

《Python下载Pandas包的步骤》:本文主要介绍Python下载Pandas包的步骤,在python中安装pandas库,我采取的方法是用PIP的方法在Python目标位置进行安装,本文给大... 目录安装步骤1、首先找到我们安装python的目录2、使用命令行到Python安装目录下3、我们回到Py

解读Pandas和Polars的区别及说明

《解读Pandas和Polars的区别及说明》Pandas和Polars是Python中用于数据处理的两个库,Pandas适用于中小规模数据的快速原型开发和复杂数据操作,而Polars则专注于高效数据... 目录Pandas vs Polars 对比表使用场景对比Pandas 的使用场景Polars 的使用

Python使用Pandas对比两列数据取最大值的五种方法

《Python使用Pandas对比两列数据取最大值的五种方法》本文主要介绍使用Pandas对比两列数据取最大值的五种方法,包括使用max方法、apply方法结合lambda函数、函数、clip方法、w... 目录引言一、使用max方法二、使用apply方法结合lambda函数三、使用np.maximum函数