David 1 maand geleden
bovenliggende
commit
352c84aa85
1 gewijzigde bestanden met toevoegingen van 2 en 0 verwijderingen
  1. 2 0
      data_processing/data_operation/data_handler.py

+ 2 - 0
data_processing/data_operation/data_handler.py

@@ -234,6 +234,8 @@ class DataHandler(object):
         col_time, features = self.opt.col_time, self.opt.features
         data = data.map(lambda x: float(x.to_decimal()) if isinstance(x, Decimal128) else float(x) if isinstance(x, numbers.Number) else x)
         data = data.sort_values(by=col_time).reset_index(drop=True, inplace=False)
+        if not set(features).issubset(set(data.columns.tolist())):
+            raise ValueError("预测数据特征不满足模型特征!")
         pre_data = data[features].copy()
         if self.opt.Model['predict_data_fill']:
             pre_data = self.fill_pre_data(pre_data)