martinvonk/SPEI

ValueError: zero-size array to reduction operation minimum which has no identity

juliammassing opened this issue · 1 comments

Hello!

I've been trying several datasets and I keep getting the same error:

Traceback (most recent call last):

Cell In[31], line 3
si.ssfi(pd.Series(df_mean_month['vazao']), dist=scs.fisk)

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/spei/si.py:251 in ssfi
ssfi.fit_distribution()

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/spei/si.py:394 in fit_distribution
fd = Dist(

File :7 in init

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/spei/dist.py:66 in post_init
pars, loc, scale = self.fit_dist(data=data_fit, dist=self.dist)

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/spei/dist.py:93 in fit_dist
fit_tuple = dist.fit(data, scale=std(data))

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/scipy/stats/_distn_infrastructure.py:2620 in fit
start = self._fitstart(data)

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/scipy/stats/_distn_infrastructure.py:2366 in _fitstart
loc, scale = self._fit_loc_scale_support(data, *args)

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/scipy/stats/_distn_infrastructure.py:2703 in _fit_loc_scale_support
data_a = np.min(data)

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/numpy/core/fromnumeric.py:2953 in min
return _wrapreduction(a, np.minimum, 'min', axis, None, out,

File ~/miniconda3/envs/spyder-env/lib/python3.12/site-packages/numpy/core/fromnumeric.py:88 in _wrapreduction
return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

ValueError: zero-size array to reduction operation minimum which has no identity

What does your data set look like? Sounds like the data is empty for certain months.