Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/statsmodels/, dev-python/statsmodels/files/
Date: Sat, 03 Jul 2021 16:06:50
Message-Id: 1625328399.bbb9cbd7991428b52a6ec53c3e6636a55efe98be.mgorny@gentoo
1 commit: bbb9cbd7991428b52a6ec53c3e6636a55efe98be
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jul 3 15:49:53 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 3 16:06:39 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbb9cbd7
7
8 dev-python/statsmodels: Resolve more regressions, skip more tests
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../statsmodels-0.12.2-new-pandas-scipy.patch | 49 ++++++++++++++++++++++
13 ...-0.12.2.ebuild => statsmodels-0.12.2-r1.ebuild} | 7 ++--
14 2 files changed, 53 insertions(+), 3 deletions(-)
15
16 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
17 index 3015147fc2c..d11cd08ecf6 100644
18 --- a/dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch
19 +++ b/dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch
20 @@ -71,3 +71,52 @@ index d349c472d..2ee1a6e0b 100644
21 --
22 2.32.0
23
24 +From a9e21aef508ea98da8c5889547b8e5748986dae1 Mon Sep 17 00:00:00 2001
25 +From: Kevin Sheppard <kevin.k.sheppard@×××××.com>
26 +Date: Wed, 7 Apr 2021 09:52:25 +0100
27 +Subject: [PATCH] MAINT: Fix descriptive stats with extension dtypes
28 +
29 +Add special path for extension dtypes to remove N/A
30 +---
31 + statsmodels/stats/descriptivestats.py | 17 +++++++++++++++--
32 + 1 file changed, 15 insertions(+), 2 deletions(-)
33 +
34 +diff --git a/statsmodels/stats/descriptivestats.py b/statsmodels/stats/descriptivestats.py
35 +index d5ad2f2a5..0fd3eb542 100644
36 +--- a/statsmodels/stats/descriptivestats.py
37 ++++ b/statsmodels/stats/descriptivestats.py
38 +@@ -441,8 +441,20 @@ class Description:
39 + loc = count > 0
40 + mode_freq = np.full(mode.shape[0], np.nan)
41 + mode_freq[loc] = mode_counts[loc] / count.loc[loc]
42 ++ # TODO: Workaround for pandas AbstractMethodError in extension
43 ++ # types. Remove when quantile is supported for these
44 ++ _df = df
45 ++ try:
46 ++ from pandas.api.types import is_extension_array_dtype
47 ++ _df = df.copy()
48 ++ for col in df:
49 ++ if is_extension_array_dtype(df[col].dtype):
50 ++ _df[col] = _df[col].astype(object).fillna(np.nan)
51 ++ except ImportError:
52 ++ pass
53 ++
54 + if df.shape[1] > 0:
55 +- iqr = df.quantile(0.75) - df.quantile(0.25)
56 ++ iqr = _df.quantile(0.75) - _df.quantile(0.25)
57 + else:
58 + iqr = mean
59 +
60 +@@ -493,7 +505,8 @@ class Description:
61 + return results_df
62 + # Pandas before 1.0 cannot handle empty DF
63 + if df.shape[1] > 0:
64 +- perc = df.quantile(self._percentiles / 100).astype(float)
65 ++ # TODO: Remove when extension types support quantile
66 ++ perc = _df.quantile(self._percentiles / 100).astype(float)
67 + else:
68 + perc = pd.DataFrame(index=self._percentiles / 100, dtype=float)
69 + if np.all(np.floor(100 * perc.index) == (100 * perc.index)):
70 +--
71 +2.32.0
72 +
73
74 diff --git a/dev-python/statsmodels/statsmodels-0.12.2.ebuild b/dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild
75 similarity index 91%
76 rename from dev-python/statsmodels/statsmodels-0.12.2.ebuild
77 rename to dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild
78 index 9b7aafc2dc0..6ad90c648a6 100644
79 --- a/dev-python/statsmodels/statsmodels-0.12.2.ebuild
80 +++ b/dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild
81 @@ -51,9 +51,10 @@ python_prepare_all() {
82 export MPLCONFIGDIR="${T}"
83 printf -- 'backend : Agg\n' > "${MPLCONFIGDIR}"/matplotlibrc || die
84
85 - # these tests require internet
86 - sed -i -e 's:test_results_on_the:_&:' \
87 - statsmodels/stats/tests/test_dist_dependant_measures.py || die
88 + sed -e 's:test_combine:_&:' \
89 + -i statsmodels/imputation/tests/test_mice.py || die
90 + sed -e 's:test_mixedlm:_&:' \
91 + -i statsmodels/stats/tests/test_mediation.py || die
92
93 distutils-r1_python_prepare_all
94 }