From 8ef17515496201be97e02f83f2c32231e48fd626 Mon Sep 17 00:00:00 2001 From: Debian Science Maintainers Date: Sun, 1 Sep 2024 11:18:24 +0100 Subject: [PATCH] Avoid cast exception in np.bincount Author: Rebecca N. Palmer Bug-Debian: https://bugs.debian.org/1030208 Forwarded: no Gbp-Pq: Name 1030208_scipy1p10.patch --- statsmodels/distributions/tests/test_discrete.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/statsmodels/distributions/tests/test_discrete.py b/statsmodels/distributions/tests/test_discrete.py index f05b13d..91730f6 100644 --- a/statsmodels/distributions/tests/test_discrete.py +++ b/statsmodels/distributions/tests/test_discrete.py @@ -330,7 +330,8 @@ class CheckDiscretized(): dfr = mod.get_distr(res.params) nobs_rvs = 500 rvs = dfr.rvs(size=nobs_rvs) - freq = np.bincount(rvs) + assert (rvs == rvs.astype(int)).all() + freq = np.bincount(rvs.astype(int))#the cast is to avoid an unsafe-cast error on 32 bit systems, https://bugs.debian.org/1030208 p = mod.predict(res.params, which="probs", k_max=nobs_rvs) k = len(freq) p[k - 1] += 1 - p[:k].sum() -- 2.30.2