13
13
import pandas as pd
14
14
import scipy .special
15
15
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
19
19
20
20
from skbio .stats .distance import DistanceMatrix
21
21
from skbio .util ._decorator import experimental
@@ -352,7 +352,7 @@ def _mantel_stats_pearson_flat(x, y_flat, permutations):
352
352
353
353
# If an input is constant, the correlation coefficient is not defined.
354
354
if (x_flat == x_flat [0 ]).all () or (y_flat == y_flat [0 ]).all ():
355
- warnings .warn (PearsonRConstantInputWarning ())
355
+ warnings .warn (ConstantInputWarning ())
356
356
return np .nan , np .nan , []
357
357
358
358
# inline pearsonr, condensed from scipy.stats.pearsonr
@@ -375,7 +375,7 @@ def _mantel_stats_pearson_flat(x, y_flat, permutations):
375
375
# If all the values in x (likewise y) are very close to the mean,
376
376
# the loss of precision that occurs in the subtraction xm = x - xmean
377
377
# might result in large errors in r.
378
- warnings .warn (PearsonRNearConstantInputWarning ())
378
+ warnings .warn (NearConstantInputWarning ())
379
379
380
380
orig_stat = np .dot (xm_normalized , ym_normalized )
381
381
@@ -471,7 +471,7 @@ def _mantel_stats_spearman(x, y, permutations):
471
471
472
472
# If an input is constant, the correlation coefficient is not defined.
473
473
if (x_flat == x_flat [0 ]).all () or (y_flat == y_flat [0 ]).all ():
474
- warnings .warn (SpearmanRConstantInputWarning ())
474
+ warnings .warn (ConstantInputWarning ())
475
475
return np .nan , np .nan , []
476
476
477
477
y_rank = scipy .stats .rankdata (y_flat )
0 commit comments