Is h5py capable of converting python dictionaries to hdf5 groups automatically? -
i have been using scipy.io save structured data (lists , dictionaries filled ndarrays in different shapes). since v7.3 mat file going replace old v7 mat format day, thinking switching hdf5 store data, more h5py python. however, noticed cannot save dictionaries easy as:
import scipy.io sio data = {'data': 'complicated structure data'} sio.savemat('filename.mat', data)
instead, have use h5py.create_group 1 one replicated structure in python dictionary. large structures, unfeasible. there easy way automatically convert python dictionaries hdf5 groups?
thank you!
-shawn
i needed kind of thing time, , decided neat make hdf5 version of pickle: https://github.com/telegraphic/hickle
the motivation storing python dictionaries of numpy arrays, sounds you're after:
import hickle hkl import numpy np data = { 'dataset1' : np.zeros((100,100)), 'dataset2' : np.random.random((100,100)) } hkl.dump(data, 'output_filename.hkl')
you should able install via pypi (pip install hickle), or download github.
cheers danny
Comments
Post a Comment