我有一個3GB的CSV文件,我嘗試使用python讀取,我需要中位數列。from numpy import * def data(): return genfromtxt('All.csv',delimiter=',')data = data() # This is where it fails already.med = zeros(len(data[0]))data = data.Tfor i in xrange(len(data)): m = median(data[i]) med[i] = 1.0/float(m)print med我得到的錯誤是這樣的:Python(1545) malloc: *** mmap(size=16777216) failed (error code=12)*** error: can't allocate region*** set a breakpoint in malloc_error_break to debugTraceback (most recent call last): File "Normalize.py", line 40, in <module> data = data() File "Normalize.py", line 39, in data return genfromtxt('All.csv',delimiter=',')File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/numpy/lib/npyio.py", line 1495, in genfromtxtfor (i, line) in enumerate(itertools.chain([first_line, ], fhd)):MemoryError我認為這只是內存不足錯誤。我正在運行具有4GB ram的64位MacOSX,并且以64位模式編譯了numpy和Python。我該如何解決?我應該嘗試僅用于內存管理的分布式方法嗎?謝謝編輯:也嘗試與此,但沒有運氣...genfromtxt('All.csv',delimiter=',', dtype=float16)
添加回答
舉報
0/150
提交
取消