Axis.to_hdf(self, filepath, key=None)[source]

Writes axis to a HDF file.

A HDF file can contain multiple axes. The ‘key’ parameter is a unique identifier for the axis.


Path where the hdf file has to be written.

keystr or Group, optional

Key (path) of the axis within the HDF file (see Notes below). If None, the name of the axis is used. Defaults to None.


Objects stored in a HDF file can be grouped together in HDF groups. If an object ‘my_obj’ is stored in a HDF group ‘my_group’, the key associated with this object is then ‘my_group/my_obj’. Be aware that a HDF group can have subgroups.


>>> a = Axis("a=a0..a2")

Save axis

>>> # by default, the key is the name of the axis
>>> a.to_hdf('test.h5')            # doctest: +SKIP

Save axis with a specific key

>>> a.to_hdf('test.h5', 'a')       # doctest: +SKIP

Save axis in a specific HDF group

>>> a.to_hdf('test.h5', 'axes/a')  # doctest: +SKIP