Browse Source

Merge branch 'dev_david' of anweiguo/algorithm_platform into dev_awg

liudawei 3 months ago
parent
commit
1ad9760aef
1 changed files with 4 additions and 1 deletions
  1. 4 1
      data_processing/data_operation/pre_data_ftp.py

+ 4 - 1
data_processing/data_operation/pre_data_ftp.py

@@ -176,7 +176,10 @@ def get_nwp_from_ftp():
         df['date_time'] = pd.to_datetime(df['date_time'])
         dfs = df.groupby('farm_id')
         for farm_id, df in dfs:
-            cdq, dq, zq = df.loc[df.index[0], ['cdq', 'dq', 'zq']]
+            if df.columns.isin(['cdq', 'dq', 'zq']):
+                cdq, dq, zq = df.loc[df.index[0], ['cdq', 'dq', 'zq']]
+            else:
+                cdq, dq, zq = 0, 0, 0
             df = df.sort_values(by='date_time')[['farm_id', 'date_time', 'power_forecast']]
             # 2. 将预测结果保存成csv临时文件,命名压缩
             zip_path, zip_file = zip_temp_file(df, args)