Save Numpy Array using Pickle

后端 未结 6 1929
独厮守ぢ
独厮守ぢ 2021-02-18 20:59

I\'ve got a Numpy array that I would like to save (130,000 x 3) that I would like to save using Pickle, with the following code. However, I keep getting the error \"EOFError: Ra

6条回答
  •  一整个雨季
    2021-02-18 21:26

    It's been a bit but if you're finding this, Pickle completes in a fraction of the time.

    with open('filename','wb') as f: pickle.dump(arrayname, f)
    
    with open('filename','rb') as f: arrayname1 = pickle.load(f)
    
    numpy.array_equal(arrayname,arrayname1) #sanity check
    

    On the other hand, by default numpy compress took my 5.2GB down to .4GB and Pickle went to 1.7GB.

提交回复
热议问题