write_dict(data,
filename,
update=True,
attr_types=[])
| source code
|
Write the content of a dictionary to a hdf5 file. The dictionary can
contain other nested dictionaries, this file stucture will be maintained
in the saved hdf5 file.
Pay attention to the fact that the data type of lists might change
when writing to hdf5. Lists are stored as numpy arrays, thus all items in
a list are converted to the same type: ['bla', 1, 24.5] will become
['bla', '1', '24.5']. Upt till now there is nothing in place to check
this, or correct it when reading a hdf5 file.
- Parameters:
data (dict) - the dictionary to write to file
filename (str) - the name of the hdf5 file to write to
update (bool) - True if you want to update an existing file, False to overwrite
attr_types (List of types) - the data types that you want to save as an attribute instead of a
dataset. (standard everything is saved as dataset.)
|