fix(yahoo): clean OHLCV frames on their own copy

- dropping undated rows copies the frame before prices are coerced, so no chained-assignment write
This commit is contained in:
Yijia-Xiao
2026-09-24 05:00:36 +00:00
parent 4187716842
commit b176c9374b
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ def _clean_dataframe(data: pd.DataFrame) -> pd.DataFrame:
the latest in-range bar (#1201)."""
data = _ensure_date_column(data)
data["Date"] = _normalize_dates(data["Date"])
data = data.dropna(subset=["Date"])
data = data.dropna(subset=["Date"]).copy()
price_cols = [c for c in ["Open", "High", "Low", "Close", "Volume"] if c in data.columns]
data[price_cols] = data[price_cols].apply(pd.to_numeric, errors="coerce")