From 5fb1cd0162b7949015eb6af88649756f1b7f6d42 Mon Sep 17 00:00:00 2001 From: Wesley Gifford <79663411+wgifford@users.noreply.github.com> Date: Wed, 31 Jul 2024 15:06:26 -0400 Subject: [PATCH] fix some frequency handling issues --- tsfm_public/toolkit/util.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tsfm_public/toolkit/util.py b/tsfm_public/toolkit/util.py index 2918c289..ebf6bde7 100644 --- a/tsfm_public/toolkit/util.py +++ b/tsfm_public/toolkit/util.py @@ -565,6 +565,9 @@ def convert_tsf(filename: str) -> pd.DataFrame: "seconds": "s", "minutes": "min", "minutely": "min", + "monthly": "MS", + "yearly": "YS", + "quarterly": "QS", } if frequency: @@ -572,9 +575,9 @@ def convert_tsf(filename: str) -> pd.DataFrame: freq_val, freq_unit = frequency.split("_") freq = freq_val + tsf_to_pandas_freq_map[freq_unit] except ValueError: - freq = tsf_to_pandas_freq_map(freq_val) + freq = tsf_to_pandas_freq_map[frequency] except KeyError: - raise ValueError(f"Input file contains an unknow frequency unit {freq_unit}") + raise ValueError(f"Input file contains an unknown frequency unit {freq_unit}") else: freq = None @@ -596,6 +599,7 @@ def convert_tsf(filename: str) -> pd.DataFrame: ) df = pd.concat(dfs) + df.reset_index(inplace=True, drop=True) return df