summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-07-03 17:49:53 +0200
committerMichał Górny <mgorny@gentoo.org>2021-07-03 18:06:39 +0200
commitbbb9cbd7991428b52a6ec53c3e6636a55efe98be (patch)
tree7e891e47e9bc6c3ca163a251cd01c2732299dfc7 /dev-python/statsmodels
parentdev-python/xarray: Backport pandas & dask compatibility fixes (diff)
downloadgentoo-bbb9cbd7991428b52a6ec53c3e6636a55efe98be.tar.gz
gentoo-bbb9cbd7991428b52a6ec53c3e6636a55efe98be.tar.bz2
gentoo-bbb9cbd7991428b52a6ec53c3e6636a55efe98be.zip
dev-python/statsmodels: Resolve more regressions, skip more tests
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/statsmodels')
-rw-r--r--dev-python/statsmodels/files/statsmodels-0.12.2-new-pandas-scipy.patch49
-rw-r--r--dev-python/statsmodels/statsmodels-0.12.2-r1.ebuild (renamed from dev-python/statsmodels/statsmodels-0.12.2.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 3015147fc2c5..d11cd08ecf6f 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 <kevin.k.sheppard@gmail.com>
+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
index 9b7aafc2dc08..6ad90c648a67 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
}