I'm trying to solve a time series problem using Prophet and I'm unable to add any external regressors. I keep getting the same error for each variable I tried. I cross checked with each variable for the availability of NaNs and I'm 100% sure NaN values are not there. I'm following the general walkthrough on the official website and my code looks similar to the following,
m = Prophet(growth='linear',changepoint_prior_scale=0.01, holidays = holidays)
m.add_regressor('cols')
m.fit(train_X)
preds = m.make_future_dataframe(periods=24,freq='H')
preds['cols'] = df['cols']
f = m.predict(preds)
And also the df dataframe has enough future data for the prediction to happen. What could be the root cause of this issue.
After 2 hours of hair pulling and running the same script over and over I finally found the issue. I was doing some preprocessing on the dataframe and dropping a few rows here and there. This caused gaps in the pandas dataframe index and for some reason prophet was throwing the NaN in column error for that. Simply reindexing the dataframe fixed my problem.
df.reset_index(drop=True)