我建立了一个数据集,其中包含以numpy数组存储的列表。使用某些文件时,我的RAM中还剩下8gb时出现内存错误。培训文件虽然只有4.5 mb大,但我正在尝试将内容附加到其他两个列表中。我在Windows 7上使用Python 3.6.7,并且numpy版本是1.15.4。
Download this file to recreate the situation (Error Message)
Download link for one file which can be opened
import numpy as np
test_x=[]
test_y=[]
file= np.load("training_data/6411-0.01848-6-1545931005000.npy")
for d in file:
test_x.append(np.array(d[0]))
test_y.append(d[1])
File "D:\Program Files\Halite3_Python3_Windows-AMD64\try.py", line 13, in <module>
file = np.load("training_data/6416-0.02775-6-1545941239000.npy")
File "C:\Users\Fred\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\npyio.py", line 433, in load
pickle_kwargs=pickle_kwargs)
File "C:\Users\Fred\AppData\Local\Programs\Python\Python36\lib\site-packages\numpy\lib\format.py", line 657, in read_array
array = pickle.load(fp, **pickle_kwargs)
MemoryError