to_hdf

hhpy.main.to_hdf(df: pandas.core.frame.DataFrame, file: str, groupby: Union[str, List[str]] = None, write_groupby: bool = True, key: str = None, replace: bool = False, format: str = 'table', do_print=True, **kwargs) → None[source]

saves a pandas DataFrame as h5 file, if groupby is supplied will save each group with a different key. Needs with groupby OR key to be supplied. Extends on pandas.DataFrame.to_hdf.

Parameters:
  • df – DataFrame to save
  • file – filename to save the DataFrame as
  • groupby – if supplied will save each sub-DataFrame as a different key [optional]
  • write_groupby – Whether groupby columns should be written to hdf [optional]
  • key – The key to write as. Ignored if groupby is supplied [optional]
  • replace – Whether to replace or append to existing files. Defaults to append [optional]
  • format – Table format to use, passed to pandas.DataFrame.to_hdf. Defaults to ‘table’ while pandas defaults to ‘fixed’ [optional]
  • do_print – Whether to print intermediate steps to console [optional]
  • kwargs – Other keyword arguments passed to pandas.DataFrame.to_hdf [optional]
Returns:

None