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: Ran out of input" or "UnsupportedOperation: read" at the pkl.load line. This is my first time using Pickle, any ideas?
Thanks,
Anant
import pickle as pkl import numpy as np arrayInput = np.zeros((1000,2)) #Trial input save = True load = True filename = path + 'CNN_Input' fileObject = open(fileName, 'wb') if save: pkl.dump(arrayInput, fileObject) fileObject.close() if load: fileObject2 = open(fileName, 'wb') modelInput = pkl.load(fileObject2) fileObject2.close() if arrayInput == modelInput: Print(True)
You should use numpy.save and numpy.load.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With