public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/statsmodels/, dev-python/statsmodels/files/
Date: Mon, 21 Jun 2021 09:45:26 +0000 (UTC)	[thread overview]
Message-ID: <1624268723.1294692a53dc54644df9d3ca088f7a290a3d288c.mgorny@gentoo> (raw)

commit:     1294692a53dc54644df9d3ca088f7a290a3d288c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 21 08:20:00 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jun 21 09:45:23 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1294692a

dev-python/statsmodels: Fix test failures

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../statsmodels-0.12.2-new-pandas-scipy.patch      | 73 ++++++++++++++++++++++
 dev-python/statsmodels/statsmodels-0.12.2.ebuild   |  3 +-
 2 files changed, 75 insertions(+), 1 deletion(-)

diff --git a/dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch b/dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch
new file mode 100644
index 00000000000..3015147fc2c
--- /dev/null
+++ b/dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch
@@ -0,0 +1,73 @@
+From 4f32f3990fbba0ee440af47e23a9354fdb7a0285 Mon Sep 17 00:00:00 2001
+From: Kevin Sheppard <kevin.sheppard@gmail.com>
+Date: Fri, 12 Mar 2021 10:52:38 +0000
+Subject: [PATCH] MAINT: Fix issues arising from future changes
+
+Fix issues due to changes in SciPy and pandas
+---
+ statsmodels/regression/tests/test_rolling.py | 6 ++++--
+ statsmodels/stats/descriptivestats.py        | 8 +++++++-
+ statsmodels/stats/stattools.py               | 4 +++-
+ 3 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/statsmodels/regression/tests/test_rolling.py b/statsmodels/regression/tests/test_rolling.py
+index 050de605f..f02e076d6 100644
+--- a/statsmodels/regression/tests/test_rolling.py
++++ b/statsmodels/regression/tests/test_rolling.py
+@@ -1,5 +1,6 @@
+ from io import BytesIO
+ from itertools import product
++import warnings
+ 
+ import numpy as np
+ import pandas as pd
+@@ -261,8 +262,9 @@ def test_plot():
+         res.plot_recursive_coefficient(variables="x4")
+ 
+     fig = plt.Figure()
+-    with pytest.warns(Warning):
+-        # Just silence the warning
++    # Just silence the warning
++    with warnings.catch_warnings():
++        warnings.simplefilter("ignore")
+         out = res.plot_recursive_coefficient(fig=fig)
+     assert out is fig
+     res.plot_recursive_coefficient(alpha=None, figsize=(30, 7))
+diff --git a/statsmodels/stats/descriptivestats.py b/statsmodels/stats/descriptivestats.py
+index 96d455ca1..d5ad2f2a5 100644
+--- a/statsmodels/stats/descriptivestats.py
++++ b/statsmodels/stats/descriptivestats.py
+@@ -446,8 +446,14 @@ class Description:
+         else:
+             iqr = mean
+ 
++        def _safe_jarque_bera(c):
++            a = np.asarray(c)
++            if a.shape[0] < 2:
++                return (np.nan,) * 4
++            return jarque_bera(a)
++
+         jb = df.apply(
+-            lambda x: list(jarque_bera(x.dropna())), result_type="expand"
++            lambda x: list(_safe_jarque_bera(x.dropna())), result_type="expand"
+         ).T
+         nan_mean = mean.copy()
+         nan_mean.loc[nan_mean == 0] = np.nan
+diff --git a/statsmodels/stats/stattools.py b/statsmodels/stats/stattools.py
+index d349c472d..2ee1a6e0b 100644
+--- a/statsmodels/stats/stattools.py
++++ b/statsmodels/stats/stattools.py
+@@ -118,7 +118,9 @@ def jarque_bera(resids, axis=0):
+     where n is the number of data points, S is the sample skewness, and K is
+     the sample kurtosis of the data.
+     """
+-    resids = np.asarray(resids)
++    resids = np.atleast_1d(np.asarray(resids, dtype=float))
++    if resids.size < 2:
++        raise ValueError("resids must contain at least 2 elements")
+     # Calculate residual skewness and kurtosis
+     skew = stats.skew(resids, axis=axis)
+     kurtosis = 3 + stats.kurtosis(resids, axis=axis)
+-- 
+2.32.0
+

diff --git a/dev-python/statsmodels/statsmodels-0.12.2.ebuild b/dev-python/statsmodels/statsmodels-0.12.2.ebuild
index d67ff026af4..9b7aafc2dc0 100644
--- a/dev-python/statsmodels/statsmodels-0.12.2.ebuild
+++ b/dev-python/statsmodels/statsmodels-0.12.2.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7..9} )
+PYTHON_COMPAT=( python3_{8..9} )
 
 inherit distutils-r1 optfeature
 
@@ -33,6 +33,7 @@ BDEPEND="
 
 PATCHES=(
 	"${FILESDIR}/statsmodels-0.11.1-tests.patch"
+	"${FILESDIR}/${P}-new-pandas-scipy.patch"
 )
 
 distutils_enable_sphinx docs \


             reply	other threads:[~2021-06-21  9:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21  9:45 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-03-10 13:24 [gentoo-commits] repo/gentoo:master commit in: dev-python/statsmodels/, dev-python/statsmodels/files/ Michał Górny
2021-07-03 16:06 Michał Górny
2020-04-29  5:49 Patrick McLean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1624268723.1294692a53dc54644df9d3ca088f7a290a3d288c.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox