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
3 changes: 2 additions & 1 deletion python/common/recluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,10 @@ 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")
print(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))

print(df["season"])
for k, v in DCLASS_NAMES.items():
df["dclass"] = df["dclass"].replace(k, v)

Expand Down
5 changes: 5 additions & 0 deletions python/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ def get_target_oday(offset=1):
return start_date

def get_season(month, seasons_and_months):
print(month)
print(seasons_and_months)
if month is None:
return None

key = [key for key, val in seasons_and_months.items() if month in val][0]
return key.lower()

Expand Down