From 1e75070ca36867093924671861c471ff424e7edb Mon Sep 17 00:00:00 2001 From: jingboyitiji Date: Fri, 28 Mar 2025 13:54:14 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=9A=E7=83=AF=E7=83=83=E6=97=A5=E5=BA=A6?= =?UTF-8?q?=E9=A2=84=E6=B5=8B=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dataread.py | 28 ++++++++++++++-------------- main_juxiting.py | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/dataread.py b/lib/dataread.py index 796c1ec..9a5ca08 100644 --- a/lib/dataread.py +++ b/lib/dataread.py @@ -977,21 +977,21 @@ def datachuli_juxiting(df_zhibiaoshuju, df_zhibiaoliebiao, datecol='date', end_t two_months_ago = current_date - timedelta(days=40) # 检查两月不更新的特征 - def check_column(col_name): - if 'ds' in col_name or 'y' in col_name: - return False - df_check_column = df[['ds', col_name]] - df_check_column = df_check_column.dropna() - if len(df_check_column) == 0: - return True - if df_check_column[(df_check_column['ds'] >= two_months_ago)].groupby(col_name).ngroups < 2: - return True - corresponding_date = df_check_column.iloc[-1]['ds'] - return corresponding_date < two_months_ago - columns_to_drop = df.columns[df.columns.map(check_column)].tolist() - df = df.drop(columns=columns_to_drop) + # def check_column(col_name): + # if 'ds' in col_name or 'y' in col_name: + # return False + # df_check_column = df[['ds', col_name]] + # df_check_column = df_check_column.dropna() + # if len(df_check_column) == 0: + # return True + # if df_check_column[(df_check_column['ds'] >= two_months_ago)].groupby(col_name).ngroups < 2: + # return True + # corresponding_date = df_check_column.iloc[-1]['ds'] + # return corresponding_date < two_months_ago + # columns_to_drop = df.columns[df.columns.map(check_column)].tolist() + # df = df.drop(columns=columns_to_drop) - config.logger.info(f'删除两月不更新特征后数据量:{df.shape}') + # config.logger.info(f'删除两月不更新特征后数据量:{df.shape}') # 删除预测列空值的行 df = df.dropna(subset=['y']) diff --git a/main_juxiting.py b/main_juxiting.py index fe365bd..ada868d 100644 --- a/main_juxiting.py +++ b/main_juxiting.py @@ -388,7 +388,7 @@ def predict_main(): if __name__ == '__main__': # global end_time # 遍历2024-11-25 到 2024-12-3 之间的工作日日期 - for i_time in pd.date_range('2025-2-1', '2025-3-18', freq='B'): + for i_time in pd.date_range('2025-2-10', '2025-3-18', freq='B'): try: global_config['end_time'] = i_time.strftime('%Y-%m-%d') predict_main()