diff --git a/src/pingouin/correlation.py b/src/pingouin/correlation.py index 24e365f9..c33d82a2 100644 --- a/src/pingouin/correlation.py +++ b/src/pingouin/correlation.py @@ -1,18 +1,17 @@ # Author: Raphael Vallat import warnings + import numpy as np import pandas as pd import pandas_flavor as pf -from scipy.spatial.distance import pdist, squareform -from scipy.stats import pearsonr, spearmanr, kendalltau - +from pingouin.bayesian import bayesfactor_pearson from pingouin.config import options -from pingouin.power import power_corr -from pingouin.multicomp import multicomp from pingouin.effsize import compute_esci -from pingouin.utils import remove_na, _perm_pval, _postprocess_dataframe -from pingouin.bayesian import bayesfactor_pearson - +from pingouin.multicomp import multicomp +from pingouin.power import power_corr +from pingouin.utils import _perm_pval,_postprocess_dataframe,remove_na +from scipy.spatial.distance import pdist,squareform +from scipy.stats import kendalltau,pearsonr,spearmanr __all__ = ["corr", "partial_corr", "pcorr", "rcorr", "rm_corr", "distance_corr"] @@ -1113,9 +1112,9 @@ def replace_pval(x): if stars: # Replace p-values by stars - mat_upper = mat_upper.applymap(replace_pval) + mat_upper=mat_upper.map(replace_pval) else: - mat_upper = mat_upper.applymap(lambda x: ffp(x, precision=decimals)) + mat_upper=mat_upper.map(lambda x:ffp(x,precision=decimals)) # Replace upper triangle by p-values or n mat.to_numpy()[tif(mat, k=1)] = mat_upper.to_numpy()[tif(mat, k=1)] diff --git a/src/pingouin/pairwise.py b/src/pingouin/pairwise.py index 5a189d8d..8a6c1e6f 100644 --- a/src/pingouin/pairwise.py +++ b/src/pingouin/pairwise.py @@ -1,16 +1,17 @@ # Author: Raphael Vallat # Date: April 2018 +import warnings +from itertools import combinations,product + import numpy as np import pandas as pd import pandas_flavor as pf -from itertools import combinations, product from pingouin.config import options -from pingouin.parametric import anova -from pingouin.multicomp import multicomp from pingouin.effsize import compute_effsize -from pingouin.utils import _check_dataframe, _flatten_list, _postprocess_dataframe +from pingouin.multicomp import multicomp +from pingouin.parametric import anova +from pingouin.utils import _check_dataframe,_flatten_list,_postprocess_dataframe from scipy.stats import studentized_range -import warnings __all__ = [ "pairwise_ttests", @@ -758,9 +759,9 @@ def replace_pval(x): if stars: # Replace p-values by stars - mat_upper = mat_upper.applymap(replace_pval) + mat_upper=mat_upper.map(replace_pval) else: - mat_upper = mat_upper.applymap(lambda x: ffp(x, precision=decimals)) + mat_upper=mat_upper.map(lambda x:ffp(x,precision=decimals)) # Replace upper triangle by p-values mat.to_numpy()[tif(mat, k=1)] = mat_upper.to_numpy()[tif(mat, k=1)]