From d5c5d8b604b51f3dd65e20643e03be75f2d24300 Mon Sep 17 00:00:00 2001 From: Wenjie Du Date: Mon, 1 Jan 2024 23:43:37 +0800 Subject: [PATCH 1/2] feat: update load_dict_from_h5() to remove the yaml part; --- pypots/data/saving/h5.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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 From 2ece024e26d5404ffe89d18c498c264ddc8618aa Mon Sep 17 00:00:00 2001 From: Wenjie Du Date: Tue, 2 Jan 2024 00:28:35 +0800 Subject: [PATCH 2/2] feat: release v0.3; --- pypots/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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