larray.read_hdf

larray.read_hdf(filepath_or_buffer, key, fill_value=nan, na=nan, sort_rows=False, sort_columns=False, name=None, **kwargs) Array[source]

Read a scalar or an axis or group or array named key from a HDF5 file in filepath (path+name).

Parameters
filepath_or_bufferstr or Path or pandas.HDFStore

Path and name where the HDF5 file is stored or a HDFStore object.

keystr or Group

Name of the scalar or axis or group or array.

fill_valuescalar or Array, optional

Value used to fill cells corresponding to label combinations which are not present in the input. Defaults to NaN.

sort_rowsbool, optional

Whether to sort the rows alphabetically. Must be False if the read array has been dumped with an larray version >= 0.30. Defaults to False.

sort_columnsbool, optional

Whether to sort the columns alphabetically. Must be False if the read array has been dumped with an larray version >= 0.30. Defaults to False.

namestr, optional

Name of the axis or group to return. If None, name is set to passed key. Defaults to None.

Returns
Array

Examples

>>> fname = get_example_filepath('examples.h5')

Read array by passing its identifier (key) inside the HDF file

>>> # The data below is derived from a subset of the demo_pjan table from Eurostat
>>> read_hdf(fname, 'pop')                     
country  gender\time      2013      2014      2015
Belgium         Male   5472856   5493792   5524068
Belgium       Female   5665118   5687048   5713206
 France         Male  31772665  32045129  32174258
 France       Female  33827685  34120851  34283895
Germany         Male  39380976  39556923  39835457
Germany       Female  41142770  41210540  41362080