From 7c0e160c7b10714d1ec7a047b533d2266b4038c6 Mon Sep 17 00:00:00 2001 From: Kristof Van Tricht Date: Wed, 21 Aug 2024 17:26:30 +0200 Subject: [PATCH] Adapt start_date before pivoting :facepalm: --- presto/inference.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/presto/inference.py b/presto/inference.py index d8f9d14..87c3321 100644 --- a/presto/inference.py +++ b/presto/inference.py @@ -402,12 +402,13 @@ def process_parquet(df: pd.DataFrame) -> pd.DataFrame: (((df["timestamp"] - df["end_date"]).dt.days + 365) / 30).round().astype(int) ) + # Now reassign start_date to the actual subset counted back from end_date + df["start_date"] = df["end_date"] - pd.Timedelta(days=364) + df_pivot = df[(df["valid_date_ind"] >= 0) & (df["valid_date_ind"] < 12)].pivot( index=index_columns, columns="valid_date_ind", values=feature_columns ) - # Now reassign start_date to the actual subset counted back from end_date - df["start_date"] = df["end_date"] - pd.Timedelta(days=364) # ---------------------------------------------------------------------------- if df_pivot.empty: