From 4f7f5c6f5df567820431ffc10b9b3a645af64322 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Tue, 8 Sep 2026 00:50:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(factor):=20=E4=B8=89=E8=A1=A8=E8=B7=A8?= =?UTF-8?q?=E8=82=A1concat=E5=88=97=E5=BA=8F=E5=AF=B9=E9=BD=90=E2=80=94?= =?UTF-8?q?=E2=80=94=E5=90=84=E8=82=A1schema=E5=AD=90=E9=9B=86=E4=B8=8D?= =?UTF-8?q?=E5=90=8C=E8=87=B4vstack=E9=94=99=E9=85=8D(=E7=9C=9F=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=86=92=E7=83=9F=E5=AE=9E=E9=94=A4)=20[nas]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NAS容器只读冒烟(3真股×2023)暴露: 合成数据列全同未触发,真数据各股文件 schema子集不同(银行模板缺列补尾部),pl.concat在select统一列序之前执行 → ShapeError。修: frames append前先select统一列序/列集。 真数据冒烟同时锁定: 茅台ROE_TTM 34%/银行tacc置NaN(红线生效)/32表达式 全通过引擎/33特征31个覆盖健康;两断供列(ASSET_IMPAIRMENT_LOSS post-2020-09、 OTHER_RECE post-~2021)为数据层采集模板问题,adapter忠实保null,遗留清单在档。 [nas] Co-Authored-By: Claude Code --- sanguo_factor/fundamental_adapter.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sanguo_factor/fundamental_adapter.py b/sanguo_factor/fundamental_adapter.py index efe6c84..d0b23ec 100644 --- a/sanguo_factor/fundamental_adapter.py +++ b/sanguo_factor/fundamental_adapter.py @@ -169,10 +169,13 @@ def _load_statements(codes: list[str], data_dir: str) -> pl.DataFrame: if df is None: continue df = _norm_dates(df, _DATE_COLS) - frames.append(df.with_columns(pl.lit(vt).alias("vt_symbol"))) + # 先统一列序/列集再入列(各股文件 schema 子集不同,concat 前必须对齐) + frames.append( + df.with_columns(pl.lit(vt).alias("vt_symbol")) + .select(["vt_symbol", *_DATE_COLS, *raw_cols])) if not frames: continue - merged = pl.concat(frames).select(["vt_symbol", *_DATE_COLS, *raw_cols]) + merged = pl.concat(frames) if table == "balance": short = {c: c for c in raw_cols} else: