Skip to content

Commit ad28d63

Browse files
gregcaporasoebolyen
authored andcommitted
MAINT: adapt to more general scipy warnings
more specific warnings were removed for scipy 1.9.0. see https://docs.scipy.org/doc/scipy/release.1.9.0.html#backwards-incompatible-changes
1 parent 5414988 commit ad28d63

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
'natsort >= 4.0.3',
153153
'numpy >= 1.9.2',
154154
'pandas >= 1.0.0',
155-
'scipy >= 1.3.0',
155+
'scipy >= 1.9.0',
156156
'h5py >= 2.9.0',
157157
'hdmedians >= 0.14.1',
158158
'scikit-learn >= 0.19.1',

skbio/stats/distance/_mantel.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
import pandas as pd
1414
import scipy.special
1515
from scipy.stats import kendalltau
16-
from scipy.stats import PearsonRConstantInputWarning
17-
from scipy.stats import PearsonRNearConstantInputWarning
18-
from scipy.stats import SpearmanRConstantInputWarning
16+
from scipy.stats import ConstantInputWarning
17+
from scipy.stats import NearConstantInputWarning
18+
from scipy.stats import ConstantInputWarning
1919

2020
from skbio.stats.distance import DistanceMatrix
2121
from skbio.util._decorator import experimental
@@ -352,7 +352,7 @@ def _mantel_stats_pearson_flat(x, y_flat, permutations):
352352

353353
# If an input is constant, the correlation coefficient is not defined.
354354
if (x_flat == x_flat[0]).all() or (y_flat == y_flat[0]).all():
355-
warnings.warn(PearsonRConstantInputWarning())
355+
warnings.warn(ConstantInputWarning())
356356
return np.nan, np.nan, []
357357

358358
# inline pearsonr, condensed from scipy.stats.pearsonr
@@ -375,7 +375,7 @@ def _mantel_stats_pearson_flat(x, y_flat, permutations):
375375
# If all the values in x (likewise y) are very close to the mean,
376376
# the loss of precision that occurs in the subtraction xm = x - xmean
377377
# might result in large errors in r.
378-
warnings.warn(PearsonRNearConstantInputWarning())
378+
warnings.warn(NearConstantInputWarning())
379379

380380
orig_stat = np.dot(xm_normalized, ym_normalized)
381381

@@ -471,7 +471,7 @@ def _mantel_stats_spearman(x, y, permutations):
471471

472472
# If an input is constant, the correlation coefficient is not defined.
473473
if (x_flat == x_flat[0]).all() or (y_flat == y_flat[0]).all():
474-
warnings.warn(SpearmanRConstantInputWarning())
474+
warnings.warn(ConstantInputWarning())
475475
return np.nan, np.nan, []
476476

477477
y_rank = scipy.stats.rankdata(y_flat)

0 commit comments

Comments
 (0)