石油焦日度预测,调试完成

This commit is contained in:
jingboyitiji 2025-03-26 13:10:55 +08:00
parent 0abd38307d
commit 8573211441
3 changed files with 2094 additions and 12 deletions

View File

@ -2223,16 +2223,17 @@ def addtimecharacteristics(df, dataset):
# 从数据库获取百川数据接收一个百川id列表返回df格式的数据
def get_baichuan_data(baichuanidnamedict):
baichuanidlist = [str(k) for k in baichuanidnamedict.keys()]
baichuanidlist= [f"'{id}'" for id in baichuanidlist]
# 连接数据库
db = config.db_mysql
db.connect()
if db is None:
db.connect()
# 执行SQL查询 select BAICHUAN_ID,DATA_DATE,DATA_VALUE from V_TBL_BAICHUAN_YINGFU_VALUE where BAICHUAN_ID in ('1588348470396475286','1666');
sql = f"SELECT BAICHUAN_ID,DATA_DATE,DATA_VALUE FROM {global_config['baichuan_table_name']} WHERE BAICHUAN_ID in ({','.join(baichuanidlist)})"
# 获取查询结果
results = db.execute_query(sql)
formatted_results = [tuple(item) for item in results]
df = pd.DataFrame(formatted_results, columns=[
df = pd.DataFrame(results, columns=[
'BAICHUAN_ID', 'DATA_DATE', 'DATA_VALUE'])
df['BAICHUAN_ID'] = df['BAICHUAN_ID'].astype('string')
df.to_csv('百川数据test.csv', index=False)

View File

@ -32,6 +32,7 @@ global_config.update({
'modelsindex': modelsindex,
'rote': rote,
'bdwd_items': bdwd_items,
'baichuanidnamedict': baichuanidnamedict,
# 特征工程开关
'is_del_corr': is_del_corr,
@ -429,16 +430,8 @@ def predict_main():
logger.info('制作报告end')
logger.info('模型训练完成')
# push_market_value()
push_market_value()
# # LSTM 单变量模型
# ex_Lstm(df,input_seq_len=input_size,output_seq_len=horizon,is_debug=is_debug,dataset=dataset)
# # lstm 多变量模型
# ex_Lstm_M(df,n_days=input_size,out_days=horizon,is_debug=is_debug,datasetpath=dataset)
# # GRU 模型
# # ex_GRU(df)
# 发送邮件
# m = SendMail(

2088
百川数据test.csv Normal file

File diff suppressed because it is too large Load Diff