From e79536ffae68cc84c2fab1f1af443b3a6f3ed47c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Jyrki=C3=A4inen?= Date: Mon, 8 Dec 2025 14:32:24 +0200 Subject: [PATCH] remove some logging, improve null check --- python/common/recluster.py | 2 -- python/common/utils.py | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/python/common/recluster.py b/python/common/recluster.py index f3d468b..99c4551 100644 --- a/python/common/recluster.py +++ b/python/common/recluster.py @@ -476,10 +476,8 @@ def ui_related_var_modifications(df: pd.DataFrame, seasons_and_months: dict, DEP pd.DataFrame: clusters with ui related variables """ df["tst_median"] = pd.to_datetime(df["tst_median"], format="%Y-%m-%d %H:%M:%S", errors="coerce") - logger.debug(df["tst_median"]) df["year"] = df["tst_median"].dt.year df["season"] = df["tst_median"].dt.month.map(lambda x: get_season(x, seasons_and_months)) - logger.debug(df["season"]) for k, v in DCLASS_NAMES.items(): df["dclass"] = df["dclass"].replace(k, v) diff --git a/python/common/utils.py b/python/common/utils.py index 37f765a..40ec4cf 100644 --- a/python/common/utils.py +++ b/python/common/utils.py @@ -1,3 +1,4 @@ +import pandas as pd import logging as logger from datetime import date, datetime, timedelta, timezone from typing import Tuple @@ -55,7 +56,7 @@ def get_target_oday(offset=1): def get_season(month, seasons_and_months): logger.debug(month) logger.debug(seasons_and_months) - if month is None: + if month is None or pd.isna(month): return None key = [key for key, val in seasons_and_months.items() if month in val][0]