导入pandas并没有引发错误,而是尝试像这样读取选取的pandas数据框:
import numpy as np
import pandas as pd
import matplotlib
import seaborn as sns
sns.set(style="white")
control_data = pd.read_pickle('null_report.pickle')
test_data = pd.read_pickle('test_report.pickle')
追溯为165行,并发三个并发异常(无论如何)。是read_pickle
不是熊猫版17.1我跑兼容?如何释放数据框以供使用?
以下是回溯副本:
ImportError Traceback (most recent call last)
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
45 with open(path, 'rb') as fh:
---> 46 return pkl.load(fh)
47 except (Exception) as e:
ImportError: No module named 'pandas.indexes'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
51 with open(path, 'rb') as fh:
---> 52 return pc.load(fh, encoding=encoding, compat=False)
53
C:\Users\test\Anaconda3\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose)
115
--> 116 return up.load()
117 except:
C:\Users\test\Anaconda3\lib\pickle.py in load(self)
1038 assert isinstance(key, bytes_types)
-> 1039 dispatch[key[0]](self)
1040 except _Stop as stopinst:
C:\Users\test\Anaconda3\lib\pickle.py in load_stack_global(self)
1342 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1343 self.append(self.find_class(module, name))
1344 dispatch[STACK_GLOBAL[0]] = load_stack_global
C:\Users\test\Anaconda3\lib\pickle.py in find_class(self, module, name)
1383 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1384 __import__(module, level=0)
1385 if self.proto >= 4:
ImportError: No module named 'pandas.indexes'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in read_pickle(path)
59 try:
---> 60 return try_read(path)
61 except:
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
56 with open(path, 'rb') as fh:
---> 57 return pc.load(fh, encoding=encoding, compat=True)
58
C:\Users\test\Anaconda3\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose)
115
--> 116 return up.load()
117 except:
C:\Users\test\Anaconda3\lib\pickle.py in load(self)
1038 assert isinstance(key, bytes_types)
-> 1039 dispatch[key[0]](self)
1040 except _Stop as stopinst:
C:\Users\test\Anaconda3\lib\pickle.py in load_stack_global(self)
1342 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1343 self.append(self.find_class(module, name))
1344 dispatch[STACK_GLOBAL[0]] = load_stack_global
C:\Users\test\Anaconda3\lib\pickle.py in find_class(self, module, name)
1383 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1384 __import__(module, level=0)
1385 if self.proto >= 4:
ImportError: No module named 'pandas.indexes'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
45 with open(path, 'rb') as fh:
---> 46 return pkl.load(fh)
47 except (Exception) as e:
ImportError: No module named 'pandas.indexes'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
51 with open(path, 'rb') as fh:
---> 52 return pc.load(fh, encoding=encoding, compat=False)
53
C:\Users\test\Anaconda3\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose)
115
--> 116 return up.load()
117 except:
C:\Users\test\Anaconda3\lib\pickle.py in load(self)
1038 assert isinstance(key, bytes_types)
-> 1039 dispatch[key[0]](self)
1040 except _Stop as stopinst:
C:\Users\test\Anaconda3\lib\pickle.py in load_stack_global(self)
1342 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1343 self.append(self.find_class(module, name))
1344 dispatch[STACK_GLOBAL[0]] = load_stack_global
C:\Users\test\Anaconda3\lib\pickle.py in find_class(self, module, name)
1383 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1384 __import__(module, level=0)
1385 if self.proto >= 4:
ImportError: No module named 'pandas.indexes'
During handling of the above exception, another exception occurred:
ImportError Traceback (most recent call last)
<ipython-input-17-3b05fe7d20a4> in <module>()
3 # test_data = np.genfromtxt(fh, usecols=2)
4
----> 5 control_data = pd.read_pickle('null_report.pickle')
6 test_data = pd.read_pickle('test_report.pickle')
7
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in read_pickle(path)
61 except:
62 if PY3:
---> 63 return try_read(path, encoding='latin1')
64 raise
C:\Users\test\Anaconda3\lib\site-packages\pandas\io\pickle.py in try_read(path, encoding)
55 except:
56 with open(path, 'rb') as fh:
---> 57 return pc.load(fh, encoding=encoding, compat=True)
58
59 try:
C:\Users\test\Anaconda3\lib\site-packages\pandas\compat\pickle_compat.py in load(fh, encoding, compat, is_verbose)
114 up.is_verbose = is_verbose
115
--> 116 return up.load()
117 except:
118 raise
C:\Users\test\Anaconda3\lib\pickle.py in load(self)
1037 raise EOFError
1038 assert isinstance(key, bytes_types)
-> 1039 dispatch[key[0]](self)
1040 except _Stop as stopinst:
1041 return stopinst.value
C:\Users\test\Anaconda3\lib\pickle.py in load_stack_global(self)
1341 if type(name) is not str or type(module) is not str:
1342 raise UnpicklingError("STACK_GLOBAL requires str")
-> 1343 self.append(self.find_class(module, name))
1344 dispatch[STACK_GLOBAL[0]] = load_stack_global
1345
C:\Users\test\Anaconda3\lib\pickle.py in find_class(self, module, name)
1382 elif module in _compat_pickle.IMPORT_MAPPING:
1383 module = _compat_pickle.IMPORT_MAPPING[module]
-> 1384 __import__(module, level=0)
1385 if self.proto >= 4:
1386 return _getattribute(sys.modules[module], name)[0]
ImportError: No module named 'pandas.indexes'
我还尝试了直接从pickle加载pickle文件:
via_pickle = pickle.load( open( 'null_report.pickle', "rb" ) )
并得到相同的错误:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-23-ba2e3adae1c4> in <module>()
1
----> 2 via_pickle = pickle.load( open( 'null_report.pickle', "rb" ) )
3
4 # control_data = pd.read_pickle('null_report.pickle')
5 # test_data = pd.read_pickle('test_report.pickle')
ImportError: No module named 'pandas.indexes'
当我使用python 2.7创建pkl文件并尝试使用python 3.6读取它时,出现了此错误:
pd.read_pickle('foo.pkl')
而且有效
问题内容: 我已经使用命令安装了redis,但是当我运行Python程序时收到此错误: 知道发生了什么问题还是我也应该安装其他软件包?我正在使用Ubuntu 13.04,并且具有Python 2.7。 问题答案: 要安装redis-py,只需: 或者(您确实应该使用点子): 或从来源: 入门 详细信息:https : //pypi.python.org/pypi/redis
问题内容: 由于某种原因,我不能使用or模块。在python shell中运行以下命令后 要么 我得到这个错误 ModuleNotFoundError:没有名为“ Tkinter”的模块 要么 ModuleNotFoundError:没有名为“ tkinter”的模块 可能是什么原因,我们如何解决呢? 问题答案: 您可能需要使用以下一种(或类似的方式)安装它: 您也可以针对python 3.7提及
问题内容: 我在 Google App Engine的Python 使用Google Translate API时遇到此错误,但是我不知道如何解决, 我将尝试 设置指示Google App Engine SDK的环境 ,然后再次上传到Google Apps Engine, 始终会收到错误消息 , 错误:服务器错误 服务器遇到错误,无法完成您的请求。如果问题仍然存在,请报告您的问题并提及此错误消息以
问题内容: 我指的是以下教程来为我的Web应用程序创建登录页面。 http://code.tutsplus.com/tutorials/intro-to-flask-signing-in-and-out--net-29982 我的数据库有问题。我正在 当我执行 我已经尝试了所有可能的方法来安装python mysql,这是本教程中提到的一种,easy_install,sudo apt-get in
问题内容: 我是这个Python世界的新手(仅1周)。我尝试安装django-mssql,但是当我尝试导入库(使用)时,出现以下错误消息: 我试图寻找那个图书馆而没有成功。 你们能指出我正确的方向吗? 问题答案: 您缺少包裹。它带有ActivePython,但您可以将它作为pywin32的一部分单独在GitHub(以前在SourceForge上)上获得。 您也可以简单地使用:
问题内容: 我目前正在练习matplotlib。这是我练习的第一个示例。 当我使用运行脚本时,它可以正确显示绘图。但是,我自己运行它,它引发了以下问题: python是否在不同位置查找matplotlib? 环境是: numpy,scipy,matplotlib已安装: 问题答案: 您的计算机上安装了两个python,一个是Mac OSX随附的标准python,第二个是您使用端口安装的python