From 15a499485ede152b6d432b7c91f1084e9e11bd8f Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Wed, 26 Jun 2024 16:08:07 +0200 Subject: [PATCH] resolve deprecation warning in base.table Use np.isnan instead of scipy.isnan. Starting from scipy 1.12 (or earlier), scipy.isnan was definitely deprecated. This made the SpearmanCorrel function silently return None which triggered a failing unit test that was reported by Andrius Merkys. --- modules/base/pymod/table.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py index 1e20e4eae..f5adc6a10 100644 --- a/modules/base/pymod/table.py +++ b/modules/base/pymod/table.py @@ -2172,6 +2172,7 @@ Statistics for column %(col)s """ try: import scipy.stats.mstats + import numpy as np if IsStringLike(col1) and IsStringLike(col2): col1 = self.GetColIndex(col1) @@ -2183,7 +2184,7 @@ Statistics for column %(col)s vals2.append(v2) try: correl = scipy.stats.mstats.spearmanr(vals1, vals2)[0] - if scipy.isnan(correl): + if np.isnan(correl): return None return correl except: -- GitLab