diff --git a/Untitled.ipynb b/Untitled.ipynb new file mode 100644 index 0000000..86a6254 --- /dev/null +++ b/Untitled.ipynb @@ -0,0 +1,185 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "id": "9048d286-415f-4a33-be3a-9d7099aa85de", + "metadata": {}, + "outputs": [], + "source": [ + "import pandas as pd\n", + "from config_jingbo import *" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "07e338e7-1dd1-417f-b4e2-65d0efc983d6", + "metadata": {}, + "outputs": [], + "source": [ + "df = pd.read_csv(os.path.join(dataset,'last_update_times.csv'))\n", + "df = df.sort_values(by=['warning_date'], ascending=[False])" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "659eec10-f0b8-4d65-b70e-6f07f45291bc", + "metadata": {}, + "outputs": [], + "source": [ + "y_last_update_time = df[df['feature']=='y']['warning_date'].values[0]\n" + ] + }, + { + "cell_type": "code", + "execution_count": 49, + "id": "31035e6f-36e8-4b17-a14b-f7dd79ae085a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
last_update_timefeature
5002024-11-14lmcads03 lme comdty
2512024-11-14美国MEH轻原油现货价格(美湾)
2312024-11-14WTI原油Cushing-C1
2642024-11-14LLS原油现货价格
822024-11-14OMAN原油:中质:远期现货DES价:山东(日)
.........
832023-01-03PVM Dubai EFS/Swap vs ICE First Month Brent
912022-11-16Brent/迪拜原油升贴水
942022-01-31W-B活跃合约价差
952022-01-31B-W活跃合约价差
312018-10-24西北欧即期Brent 211利润
\n", + "

73 rows × 2 columns

\n", + "
" + ], + "text/plain": [ + " last_update_time feature\n", + "500 2024-11-14 lmcads03 lme comdty\n", + "251 2024-11-14 美国MEH轻原油现货价格(美湾)\n", + "231 2024-11-14 WTI原油Cushing-C1\n", + "264 2024-11-14 LLS原油现货价格\n", + "82 2024-11-14 OMAN原油:中质:远期现货DES价:山东(日)\n", + ".. ... ...\n", + "83 2023-01-03 PVM Dubai EFS/Swap vs ICE First Month Brent\n", + "91 2022-11-16 Brent/迪拜原油升贴水\n", + "94 2022-01-31 W-B活跃合约价差\n", + "95 2022-01-31 B-W活跃合约价差\n", + "31 2018-10-24 西北欧即期Brent 211利润\n", + "\n", + "[73 rows x 2 columns]" + ] + }, + "execution_count": 49, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "df[df['warning_date'] 0: + content = '原油特征指标预警信息:\n\n' + warning_data_df = warning_data_df.sort_values(by='last_update_time',ascending=False) + for ds, df in warning_data_df.groupby('last_update_time'): + content += f'{ds} \n {df["feature"].to_string(index=False).replace(" ", "")}\n\n' + else: + logger.info(f'没有需要上传的预警信息') + content = '没有需要维护的特征指标' warning_data['data']['WARNING_DATE'] = y_last_update_time - warning_data['data']['WARNING_CONTENT'] = warning_data_df.to_string(index=False) + warning_data['data']['WARNING_CONTENT'] = content token = get_head_auth_report() upload_warning_data(token, warning_data) logger.info(f'上传预警信息成功') diff --git a/main_yuanyou.py b/main_yuanyou.py index 51afe07..e2c6698 100644 --- a/main_yuanyou.py +++ b/main_yuanyou.py @@ -45,7 +45,7 @@ def predict_main(): # 读取数据 logger.info('读取本地数据:'+os.path.join(dataset,data_set)) df = getdata(filename=os.path.join(dataset,data_set),y=y,dataset=dataset,add_kdj=add_kdj,is_timefurture=is_timefurture,end_time=end_time) # 原始数据,未处理 - + # 更改预测列名称 df.rename(columns={y:'y'},inplace=True)