聚烯烃日度预测调试
This commit is contained in:
parent
27960c9083
commit
1e75070ca3
@ -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'])
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user