twallema / pySODM

Simulating and Optimising Dynamical Models in Python 3
Other
9 stars 2 forks source link

Error performing `df.values` in `__call__()` method of class `log_posterior_probability()` when optimising a model with a timeseries of length 1 #63

Open twallema opened 1 year ago

twallema commented 1 year ago

I accidently tried optimising a model to a timeseries with only one datapoint,

date
2020-03-15    2753.51636
Name: GDP, dtype: float64

Which resulted in an error on the following line in __call__() of class log_posterior_probability(),

ydata = np.expand_dims(df.squeeze().values,axis=1)

Specifically, the .values method of df.squeeze() does not work and results in the following error,

AttributeError: 'numpy.float64' object has no attribute 'values'

It's a specific situation but I may need to address this at some point.