持仓排名数据清洗,机构名称为空时用名次兜底
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -293,10 +293,14 @@ def fetch_position_rankings(contract_code: str, trade_date: str) -> list[dict]:
|
||||
|
||||
for _, row in df.iterrows():
|
||||
try:
|
||||
inst = str(row["会员简称"]).strip()
|
||||
rank = int(row["名次"])
|
||||
if inst in ("-", ""):
|
||||
inst = f"-{rank}"
|
||||
results.append({
|
||||
"data_type": dtype,
|
||||
"rank": int(row["名次"]),
|
||||
"institution": str(row["会员简称"]),
|
||||
"rank": rank,
|
||||
"institution": inst,
|
||||
"value": int(row.iloc[2]),
|
||||
"change": int(row["比上交易增减"]),
|
||||
})
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user