commit: bbb9cbd7991428b52a6ec53c3e6636a55efe98be Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jul 3 15:49:53 2021 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Sat Jul 3 16:06:39 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bbb9cbd7
dev-python/statsmodels: Resolve more regressions, skip more tests Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../statsmodels-0.12.2-new-pandas-scipy.patch | 49 ++++++++++++++++++++++ ...-0.12.2.ebuild => statsmodels-0.12.2-r1.ebuild} | 7 ++-- 2 files changed, 53 insertions(+), 3 deletions(-) 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 index 3015147fc2c..d11cd08ecf6 100644 --- 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 @@ -71,3 +71,52 @@ index d349c472d..2ee1a6e0b 100644 -- 2.32.0 +From a9e21aef508ea98da8c5889547b8e5748986dae1 Mon Sep 17 00:00:00 2001 +From: Kevin Sheppard <[email protected]> +Date: Wed, 7 Apr 2021 09:52:25 +0100 +Subject: [PATCH] MAINT: Fix descriptive stats with extension dtypes + +Add special path for extension dtypes to remove N/A +--- + statsmodels/stats/descriptivestats.py | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/statsmodels/stats/descriptivestats.py b/statsmodels/stats/descriptivestats.py +index d5ad2f2a5..0fd3eb542 100644 +--- a/statsmodels/stats/descriptivestats.py ++++ b/statsmodels/stats/descriptivestats.py +@@ -441,8 +441,20 @@ class Description: + loc = count > 0 + mode_freq = np.full(mode.shape[0], np.nan) + mode_freq[loc] = mode_counts[loc] / count.loc[loc] ++ # TODO: Workaround for pandas AbstractMethodError in extension ++ # types. Remove when quantile is supported for these ++ _df = df ++ try: ++ from pandas.api.types import is_extension_array_dtype ++ _df = df.copy() ++ for col in df: ++ if is_extension_array_dtype(df[col].dtype): ++ _df[col] = _df[col].astype(object).fillna(np.nan) ++ except ImportError: ++ pass ++ + if df.shape[1] > 0: +- iqr = df.quantile(0.75) - df.quantile(0.25) ++ iqr = _df.quantile(0.75) - _df.quantile(0.25) + else: + iqr = mean + +@@ -493,7 +505,8 @@ class Description: + return results_df + # Pandas before 1.0 cannot handle empty DF + if df.shape[1] > 0: +- perc = df.quantile(self._percentiles / 100).astype(float) ++ # TODO: Remove when extension types support quantile ++ perc = _df.quantile(self._percentiles / 100).astype(float) + else: + perc = pd.DataFrame(index=self._percentiles / 100, dtype=float) + if np.all(np.floor(100 * perc.index) == (100 * perc.index)): +-- +2.32.0 + diff --git a/dev-python/statsmodels/statsmodels-0.12.2.ebuild b/dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild similarity index 91% rename from dev-python/statsmodels/statsmodels-0.12.2.ebuild rename to dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild index 9b7aafc2dc0..6ad90c648a6 100644 --- a/dev-python/statsmodels/statsmodels-0.12.2.ebuild +++ b/dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild @@ -51,9 +51,10 @@ python_prepare_all() { export MPLCONFIGDIR="${T}" printf -- 'backend : Agg\n' > "${MPLCONFIGDIR}"/matplotlibrc || die - # these tests require internet - sed -i -e 's:test_results_on_the:_&:' \ - statsmodels/stats/tests/test_dist_dependant_measures.py || die + sed -e 's:test_combine:_&:' \ + -i statsmodels/imputation/tests/test_mice.py || die + sed -e 's:test_mixedlm:_&:' \ + -i statsmodels/stats/tests/test_mediation.py || die distutils-r1_python_prepare_all }
