scikit_posthocs.posthoc_wilcoxon(a: list | ndarray | DataFrame, val_col: str = None, group_col: str = None, method: str = 'auto', zero_method: str = 'wilcox', correction: bool = False, p_adjust: str = None, sort: bool = False) DataFrame

Pairwise comparisons with Wilcoxon signed-rank test.

It is a non-parametric version of the paired T-test for use with non-parametric ANOVA.

  • a (array_like or pandas DataFrame object) – An array, any object exposing the array interface or a pandas DataFrame. Array must be two-dimensional.

  • val_col (str, optional) – Name of a DataFrame column that contains dependent variable values (test or response variable). Values should have a non-nominal scale. Must be specified if a is a pandas DataFrame object.

  • group_col (str, optional) – Name of a DataFrame column that contains independent variable values (grouping or predictor variable). Values should have a nominal scale (categorical). Must be specified if a is a pandas DataFrame object.

  • method ({"auto", "exact", "approx"}, optional) – Method to calculate the p-value. Default is “auto”.

  • zero_method ({"pratt", "wilcox", "zsplit"}, optional) – “pratt”: Pratt treatment, includes zero-differences in the ranking process (more conservative) “wilcox”: Wilcox treatment, discards all zero-differences “zsplit”: Zero rank split, just like Pratt, but spliting the zero rank between positive and negative ones

  • correction (bool, optional) – If True, apply continuity correction by adjusting the Wilcoxon rank statistic by 0.5 towards the mean value when computing the z-statistic. Default is False.

  • p_adjust (str, optional) – Method for adjusting p values. See statsmodels.sandbox.stats.multicomp for details. Available methods are: ‘bonferroni’ : one-step correction ‘sidak’ : one-step correction ‘holm-sidak’ : step-down method using Sidak adjustments ‘holm’ : step-down method using Bonferroni adjustments ‘simes-hochberg’ : step-up method (independent) ‘hommel’ : closed method based on Simes tests (non-negative) ‘fdr_bh’ : Benjamini/Hochberg (non-negative) ‘fdr_by’ : Benjamini/Yekutieli (negative) ‘fdr_tsbh’ : two stage fdr correction (non-negative) ‘fdr_tsbky’ : two stage fdr correction (non-negative)

  • sort (bool, optional) – Specifies whether to sort DataFrame by group_col and val_col or not. Default is False.


result – P values.

Return type:



Refer to scipy.stats.wilcoxon reference page for further details [1].



>>> x = [[1,2,3,4,5], [35,31,75,40,21], [10,6,9,6,1]]
>>> sp.posthoc_wilcoxon(x)