i coming matlab background , started coding in python. generate massive data using monte carlo , these 10 dimensional arrays. in matlab have been using .mat file format store these arrays, along inputs , other parameters using struct.
what recommended storage or equivalent python ?
the standard object serialization in python pickle. docs
“pickling” process whereby python object hierarchy converted byte stream, , “unpickling” inverse operation, whereby byte stream (from binary file or bytes-like object) converted object hierarchy.
an example be
import pickle mydata = [1, 2, 3, 5] pickle.dump(mydata, open("mydata.p", "wb")) mydata2 = pickle.load(open("mydata.p", "rb"))
an alternative use h5py third party module writing data hdf5 format. depending on application, more performant solution since hdf5 designed large numerical data sets in mind. in fact, latest .mat files actual designed on top of hdf5 files, source.
Comments
Post a Comment