h5
Python interface to the h5 library: a dict-like API for reading and writing HDF5 files.
See h5.archive for the main archive classes and h5.formats for
registering custom classes.
Examples
Values are written and read back by key, and standard Python containers as well as numpy arrays are supported out of the box:
import numpy as np
from h5 import HDFArchive
# write some data to an archive
with HDFArchive("example.h5", 'w') as ar:
ar['x'] = 1.0
ar['vec'] = np.array([1, 2, 3])
ar['params'] = {'beta': 10.0, 'n': 5}
# read it back
with HDFArchive("example.h5", 'r') as ar:
print(ar.keys()) # ['params', 'vec', 'x']
print(ar['x']) # 1.0
print(ar['params']) # {'beta': 10.0, 'n': 5}
Modules
Dict-like Python interface to HDF5 files. |
|
Low-level bridge between |
|
Registration mechanism for archive-compatible Python classes. |
|
Version information for the h5 package. |