From 016b13a8f178d594a3878a4296c04f07f4279442 Mon Sep 17 00:00:00 2001 From: 21in7 Date: Mon, 2 Mar 2026 14:13:00 +0900 Subject: [PATCH] fix: fill NaN in oi_change/funding_rate after concat when columns missing in existing parquet Made-with: Cursor --- scripts/fetch_history.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/fetch_history.py b/scripts/fetch_history.py index 14d50d3..ddbfa12 100644 --- a/scripts/fetch_history.py +++ b/scripts/fetch_history.py @@ -306,6 +306,11 @@ def upsert_parquet(path: "Path | str", new_df: pd.DataFrame) -> pd.DataFrame: if len(new_only_idx) > 0: existing = pd.concat([existing, new_df.loc[new_only_idx]]) + # 컬럼 불일치(기존 parquet에 oi_change/funding_rate 없음)로 생긴 NaN을 0으로 채움 + for col in UPSERT_COLS: + if col in existing.columns: + existing[col] = existing[col].fillna(0.0) + return existing.sort_index()