当我用pandas加载一个大的CSV文件时,我得到以下内存错误:
Traceback (most recent call last):
File "/home/k/workspace/loans/src/loans.py", line 100, in <module>
X_test = testdata('test_v2.csv')
File "/home/k/workspace/loans/src/loans.py", line 18, in testdata
X = pd.read_table(filename, sep=',', warn_bad_lines=True, error_bad_lines=True)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 420, in parser_f
return _read(filepath_or_buffer, kwds)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 225, in _read
return parser.read()
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 626, in read
ret = self._engine.read(nrows)
File "/usr/local/lib/python2.7/dist-packages/pandas/io/parsers.py", line 1070, in read
data = self._reader.read(nrows)
File "parser.pyx", line 727, in pandas.parser.TextReader.read (pandas/parser.c:6866)
File "parser.pyx", line 777, in pandas.parser.TextReader._read_low_memory (pandas/parser.c:7452)
File "parser.pyx", line 1788, in pandas.parser._concatenate_chunks (pandas/parser.c:20462)
MemoryError
文件大小为1 GB。R打开它没有太大麻烦(这很奇怪,因为如果我理解正确,R的级别比Python高…)
我在Intel(R)Core(TM)i3CPU 550上运行代码,速度为3.20GHz,内存为4GB。我正在运行Linux Ubuntu12.0432位代码。在
有什么诀窍让它成功吗?在
谢谢!在
目前没有回答
相关问题 更多 >
编程相关推荐