If ds column is int, convert to str before pd.to_datetime to avoid nanosecond casting (#675)

This commit is contained in:
Ben Letham 2019-05-06 16:38:13 -07:00
parent 4e5e223e4f
commit 26f60c0a49

View file

@ -236,6 +236,8 @@ class Prophet(object):
df['y'] = pd.to_numeric(df['y'])
if np.isinf(df['y'].values).any():
raise ValueError('Found infinity in column y.')
if df['ds'].dtype == np.int64:
df['ds'] = df['ds'].astype(str)
df['ds'] = pd.to_datetime(df['ds'])
if df['ds'].isnull().any():
raise ValueError('Found NaN in column ds.')