Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions python/common/recluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion python/common/utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import pandas as pd
import logging as logger
from datetime import date, datetime, timedelta, timezone
from typing import Tuple
Expand Down Expand Up @@ -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]
Expand Down