auto-sync: 2026-05-03 10:46:57
This commit is contained in:
@@ -142,8 +142,13 @@ def update_daily_parquet(code: str, new_data: pd.DataFrame) -> int:
|
||||
year = datetime.now().year
|
||||
parquet_path = DAILY_DIR / str(year) / f"{prefix}{clean}_daily.parquet"
|
||||
|
||||
# 确保date为字符串类型,避免和已有parquet的datetime.date冲突
|
||||
new_data = new_data.copy()
|
||||
new_data["date"] = new_data["date"].astype(str)
|
||||
|
||||
if parquet_path.exists():
|
||||
existing = pd.read_parquet(parquet_path)
|
||||
existing["date"] = existing["date"].astype(str)
|
||||
combined = pd.concat([existing, new_data], ignore_index=True)
|
||||
combined = combined.drop_duplicates(subset=["date"], keep="last")
|
||||
combined = combined.sort_values("date").reset_index(drop=True)
|
||||
|
||||
Reference in New Issue
Block a user