diff --git a/pypots/__init__.py b/pypots/__init__.py index 5238b9f7..5f0cb4c5 100644 --- a/pypots/__init__.py +++ b/pypots/__init__.py @@ -22,7 +22,7 @@ # # Dev branch marker is: 'X.Y.dev' or 'X.Y.devN' where N is an integer. # 'X.Y.dev0' is the canonical version of 'X.Y.dev' -__version__ = "0.2.1" +__version__ = "0.3" from . import imputation, classification, clustering, forecasting, optim, data, utils diff --git a/pypots/data/saving/h5.py b/pypots/data/saving/h5.py index 0b4ca735..cb168428 100644 --- a/pypots/data/saving/h5.py +++ b/pypots/data/saving/h5.py @@ -11,7 +11,6 @@ from typing import Optional import h5py -import yaml from ...utils.file import extract_parent_dir, create_dir_if_not_exist from ...utils.logging import logger @@ -93,6 +92,10 @@ def load_dict_from_h5( ) -> dict: """Load the data from the given h5 file and return as a Python dictionary. + Notes + ----- + This implementation was inspired by https://github.com/SiggiGue/hdfdict/blob/master/hdfdict/hdfdict.py#L93 + Parameters ---------- file_path : str, @@ -117,13 +120,12 @@ def load_set(handle, datadict): elif isinstance(item, h5py.Dataset): value = item[()] if "_type_" in item.attrs: + # in case that datetime type of data was saved as timestamps if item.attrs["_type_"].astype(str) == "datetime": if hasattr(value, "__iter__"): value = [datetime.fromtimestamp(ts) for ts in value] else: value = datetime.fromtimestamp(value) - elif item.attrs["_type_"].astype(str) == "yaml": - value = yaml.safe_load(value.decode()) datadict[key] = value return datadict