From ea4dd6ef4651f1cd529010beb7aa081cd253ecfc Mon Sep 17 00:00:00 2001 From: "Wesley M. Gifford" Date: Wed, 10 Jul 2024 21:03:58 -0400 Subject: [PATCH] check for None --- tsfm_public/toolkit/time_series_preprocessor.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tsfm_public/toolkit/time_series_preprocessor.py b/tsfm_public/toolkit/time_series_preprocessor.py index f65f3234..f32258cc 100644 --- a/tsfm_public/toolkit/time_series_preprocessor.py +++ b/tsfm_public/toolkit/time_series_preprocessor.py @@ -453,13 +453,15 @@ def get_frequency_token(self, token_name: str): try: token_name_offs = to_offset(token_name).freqstr token = self.frequency_mapping.get(token_name_offs, None) - return token + if token is not None: + return token except ValueError: # lastly try to map the timedelta to a frequency string token_name_td = pd._libs.tslibs.timedeltas.Timedelta(token_name) token_name_offs = to_offset(token_name_td).freqstr token = self.frequency_mapping.get(token_name_offs, None) - return token + if token is not None: + return token warn(f"Frequency token {token_name} was not found in the frequncy token mapping.") token = self.frequency_mapping["oov"]