Avoid cast exception in np.bincount
authorDebian Science Maintainers <debian-science-maintainers@lists.alioth.debian.org>
Sun, 21 Jan 2024 09:38:29 +0000 (09:38 +0000)
committerRebecca N. Palmer <rebecca_palmer@zoho.com>
Sun, 21 Jan 2024 09:38:29 +0000 (09:38 +0000)
Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Bug-Debian: https://bugs.debian.org/1030208
Forwarded: no

Gbp-Pq: Name 1030208_scipy1p10.patch

statsmodels/distributions/tests/test_discrete.py

index b744ebae55f4a57b26fa9a5712e3515ec4ad634e..d986f3081189a54576a300274efb5fd019f37725 100644 (file)
@@ -332,7 +332,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()