原油数据处理,最高最低价拼接 调试
This commit is contained in:
commit
6f3680e4c6
@ -364,7 +364,7 @@ table_name = 'v_tbl_crude_oil_warning'
|
||||
|
||||
|
||||
# 开关
|
||||
is_train = True # 是否训练
|
||||
is_train = False # 是否训练
|
||||
is_debug = False # 是否调试
|
||||
is_eta = True # 是否使用eta接口
|
||||
is_market = True # 是否通过市场信息平台获取特征 ,在is_eta 为true 的情况下生效
|
||||
|
@ -875,6 +875,13 @@ def datachuli(df_zhibiaoshuju, df_zhibiaoliebiao, datecol='date', end_time='', y
|
||||
dataset, '特征处理后的指标名称及分类.csv'), index=False)
|
||||
# 数据频度分析
|
||||
featurePindu(dataset=dataset)
|
||||
|
||||
# 原油最高最低价列误删重新拼接,后面更新最高价最低价用,计算准确率用
|
||||
if 'Brentzgj' not in df.columns and 'Brentzgj' in df_zhibiaoliebiao.columns:
|
||||
df['Brentzgj'] = df_zhibiaoliebiao['Brentzgj']
|
||||
if 'Brentzdj' not in df.columns and 'Brentzdj' in df_zhibiaoliebiao.columns:
|
||||
df['Brentzdj'] = df_zhibiaoliebiao['Brentzdj']
|
||||
|
||||
# 向上填充
|
||||
df = df.ffill()
|
||||
# 向下填充
|
||||
@ -972,7 +979,6 @@ def zhoududatachuli(df_zhibiaoshuju, df_zhibiaoliebiao, datecol='date', end_time
|
||||
return df
|
||||
|
||||
|
||||
|
||||
def datachuli_juxiting(df_zhibiaoshuju, df_zhibiaoliebiao, datecol='date', end_time='', y='y', dataset='dataset', delweekenday=False, add_kdj=False, is_timefurture=False):
|
||||
'''
|
||||
聚烯烃特征数据处理函数,
|
||||
@ -1165,8 +1171,6 @@ def yuedudatachuli_shiyoujiaolvyong(df_zhibiaoshuju, df_zhibiaoliebiao, datecol=
|
||||
return df
|
||||
|
||||
|
||||
|
||||
|
||||
def getdata(filename, datecol='date', y='y', dataset='', add_kdj=False, is_timefurture=False, end_time=''):
|
||||
config.logger.info('getdata接收:'+filename+' '+datecol+' '+end_time)
|
||||
# 判断后缀名 csv或excel
|
||||
|
@ -294,15 +294,15 @@ def predict_main():
|
||||
logger.info(f'要更新y的信息:{update_y}')
|
||||
# try:
|
||||
for row in update_y.itertuples(index=False):
|
||||
try:
|
||||
row_dict = row._asdict()
|
||||
yy = df[df['ds'] == row_dict['ds']]['y'].values[0]
|
||||
LOW = df[df['ds'] == row_dict['ds']]['Brentzdj'].values[0]
|
||||
HIGH = df[df['ds'] == row_dict['ds']]['Brentzgj'].values[0]
|
||||
sqlitedb.update_data(
|
||||
'accuracy', f"y = {yy},LOW_PRICE = {LOW},HIGH_PRICE = {HIGH}", where_condition=f"ds = '{row_dict['ds']}'")
|
||||
except:
|
||||
logger.info(f'更新accuracy表的y值失败:{row_dict}')
|
||||
# try:
|
||||
row_dict = row._asdict()
|
||||
yy = df[df['ds'] == row_dict['ds']]['y'].values[0]
|
||||
LOW = df[df['ds'] == row_dict['ds']]['Brentzdj'].values[0]
|
||||
HIGH = df[df['ds'] == row_dict['ds']]['Brentzgj'].values[0]
|
||||
sqlitedb.update_data(
|
||||
'accuracy', f"y = {yy},LOW_PRICE = {LOW},HIGH_PRICE = {HIGH}", where_condition=f"ds = '{row_dict['ds']}'")
|
||||
# except:
|
||||
# logger.info(f'更新accuracy表的y值失败:{row_dict}')
|
||||
# except Exception as e:
|
||||
# logger.info(f'更新accuracy表的y值失败:{e}')
|
||||
|
||||
|
@ -19,6 +19,7 @@ global_config.update({
|
||||
'is_update_report': is_update_report,
|
||||
'settings': settings,
|
||||
'bdwdname': bdwdname,
|
||||
'columnsrename': columnsrename,
|
||||
|
||||
|
||||
# 模型参数
|
||||
|
Loading…
Reference in New Issue
Block a user