Pandas has a nice interface that makes it easy to store things like Dataframes and Series in HDF5:
random_matrix = np.random.random_integers(0,10, m_size) my_dataframe = pd.DataFrame(random_matrix) store = pd.HDFStore('some_file.h5',complevel=9, complib='bzip2') store['my_dataframe'] = my_dataframe store.close()
But if I try to save some other regular Python objects in a single file, it complains:
my_dictionary = dict() my_dictionary['a'] = 2 # <--- ERROR my_dictionary['b'] = [2,3,4] store['my_dictionary'] = my_dictionary store.close()
from
TypeError: cannot properly create the storer for: [_TYPE_MAP] [group->/par ameters (Group) u'',value-><type 'dict'>,table->None,append->False,kwargs- >{}]
How can I store regular Python data structures in one HDF5 where I store other Pandas objects?
python pandas hdf5
Amelio Vazquez-Reina Jul 23 '13 at 20:08 2013-07-23 20:08
source share