WP46: panel reader always loads timestamp_utc
1 changed file +1 −0
modified
src/wp46/preprocessing/panel.py
+1 −0
@@ -35,6 +35,7 @@ def _read_cache(dataset_id: str, symbol: str, cols: list[str]) -> pd.DataFrame: | ||
| 35 | 35 | files = sorted(glob.glob(str(cache_root() / "bars" / dataset_id / symbol / "*.parquet"))) |
| 36 | 36 | if not files: |
| 37 | 37 | raise FileNotFoundError(f"no cached bars for {dataset_id}/{symbol}") |
| 38 | + cols = list(dict.fromkeys(["timestamp_utc"] + cols)) | |
| 38 | 39 | df = pd.concat([pq.read_table(f, columns=cols).to_pandas() for f in files], ignore_index=True) |
| 39 | 40 | df["timestamp_utc"] = pd.to_datetime(df["timestamp_utc"], utc=True) |
| 40 | 41 | df = df.drop_duplicates("timestamp_utc").sort_values("timestamp_utc").reset_index(drop=True) |
| 41 | 42 | |