windows-desktop: C端基线(Windows 本地实时分析器 + 采集器 bug 修复)
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
"""全库导出为 xlsx(每个表一个 sheet)"""
|
||||
import sqlite3
|
||||
import pandas as pd
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
|
||||
DB = r'C:\Users\lookt\a_stock_timeline\data\a_stock.db'
|
||||
OUT = r'C:\Users\lookt\a_stock_timeline\data\a_stock_all.xlsx'
|
||||
|
||||
TABLES = [
|
||||
'trade_calendar',
|
||||
'stock_daily',
|
||||
'lhb_daily',
|
||||
'news_flash',
|
||||
'macro_event',
|
||||
'news_cn',
|
||||
'money_flow',
|
||||
'global_index',
|
||||
]
|
||||
|
||||
conn = sqlite3.connect(DB)
|
||||
|
||||
with pd.ExcelWriter(OUT, engine='openpyxl', datetime_format='YYYY-MM-DD') as writer:
|
||||
for tbl in TABLES:
|
||||
df = pd.read_sql(f'SELECT * FROM {tbl}', conn)
|
||||
print(f'{tbl}: {len(df)} 行 -> sheet')
|
||||
df.to_excel(writer, sheet_name=tbl, index=False)
|
||||
|
||||
conn.close()
|
||||
print(f'\n[OK] 导出完成: {OUT}')
|
||||
Reference in New Issue
Block a user