Issue new data reading as NaN


I’m having issues passing OOS data to a model for sampling. I’m using the following code snippet to pass OOS data:

t_test = np.arange(1, 1+12/T, 1/T) #add one to time steps
test_x_fourier = create_fourier_features(t_test, n=5, p=12/T)

with constant_model:
    test_item_idx = np.array(list(map(item_to_idx_dict.get, df_test.index.get_level_values(1))))
    test_time_idx, _ = pd.factorize(df_test.index.get_level_values(0))
    test_price_idx = df_test['price_group'].astype('int')-1
    test_promo_idx_, _ = pd.factorize(df_test['PROMO_FLG'].astype('int'))
                 't': t_test,
    test_ppc = pm.sample_posterior_predictive(idata)

However, I’m all of the sudden (this worked a week ago), getting the following error:

TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_129069/ in <module>
     15                  't': t_test,
     16                  'x_fourier':test_x_fourier,
---> 17                  'promo':test_promo_idx})
     19     test_ppc = pm.sample_posterior_predictive(idata)

/opt/conda/lib/python3.7/site-packages/pymc/ in set_data(new_data, model, coords)
   1874     for variable_name, new_value in new_data.items():
-> 1875         model.set_data(variable_name, new_value, coords=coords)

/opt/conda/lib/python3.7/site-packages/pymc/ in set_data(self, name, values, coords)
   1227         if isinstance(values, list):
   1228             values = np.array(values)
-> 1229         values = convert_observed_data(values)
   1230         dims = self.RV_dims.get(name, None) or ()
   1231         coords = coords or {}

/opt/conda/lib/python3.7/site-packages/pymc/ in convert_observed_data(data)
    116         else:
    117             # already a ndarray, but not masked
--> 118             mask = np.isnan(data)
    119             if np.any(mask):
    120                 ret =, mask)

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

I’ve checked my data and there is no nan values in it. The dtypes of the data match the dtypes of the data the model was fit on. Has anyone else seen this?

This is actually a result of my test data having groups in it, that were not in the training dataset.