From b014e385b9d082f896bf2754daccd2da7414ddaf Mon Sep 17 00:00:00 2001 From: Nicolas Schmid <nicolas@breiten.ch> Date: Thu, 22 Jun 2023 12:17:50 +0200 Subject: [PATCH] fix: add fix so that hydraulic datetime stamps are returned as IO Time string --- hydws/utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hydws/utils.py b/hydws/utils.py index 82d33fb..3beaa8d 100644 --- a/hydws/utils.py +++ b/hydws/utils.py @@ -28,6 +28,10 @@ def real_values_to_json(df: pd.DataFrame, drop_cols: list[str] = None) -> str: df = df.stack(level=1) + if 'datetime' in df.columns: + df['datetime'] = pd.to_datetime( + df['datetime']).dt.strftime('%Y-%m-%dT%H:%M:%S') + if df_not_real is not None: result = df.groupby(level=0) \ .apply(lambda x: x.droplevel(0).to_dict() -- GitLab