浏览代码

Check for NULL in ds column

bl 8 年之前
父节点
当前提交
8383d3bea6
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      python/fbprophet/forecaster.py

+ 2 - 0
python/fbprophet/forecaster.py

@@ -174,6 +174,8 @@ class Prophet(object):
         if 'y' in df:
         if 'y' in df:
             df['y'] = pd.to_numeric(df['y'])
             df['y'] = pd.to_numeric(df['y'])
         df['ds'] = pd.to_datetime(df['ds'])
         df['ds'] = pd.to_datetime(df['ds'])
+        if df['ds'].isnull().any():
+            raise ValueError('Found NaN in column ds.')
 
 
         df = df.sort_values('ds')
         df = df.sort_values('ds')
         df.reset_index(inplace=True, drop=True)
         df.reset_index(inplace=True, drop=True)