Open secondtom opened 11 months ago
I don't know how many hours I wasted chasing down this tricky behavior. The worst part was there were no warnings and model fits fine also, the predictions are however very poor. My fix was:
pd.set_option("mode.copy_on_write", True)
df_group["ts"] = df_group["ts"].astype('datetime64[ns]')
I was unknowingly passing a dtype of
datetime64[ms]
to prophet and getting a very poor fit. Converted back todatetime64[ns]
and model fit behaved as expected. It might be worth adding a check to warn other users.My approach to convert was:
df['ds'] = pd.to_datetime(df['ds'].dt.strftime('%Y-%m-%d'))