Skip to content

Commit

Permalink
Adapt start_date before pivoting 🤦
Browse files Browse the repository at this point in the history
  • Loading branch information
kvantricht committed Aug 21, 2024
1 parent 750930b commit 7c0e160
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions presto/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 7c0e160

Please sign in to comment.