scikit_posthocs.posthoc_mannwhitney(a: Union[list, ndarray, DataFrame], val_col: Optional[str] = None, group_col: Optional[str] = None, use_continuity: bool = True, alternative: str = 'two-sided', p_adjust: Optional[str] = None, sort: bool = True) DataFrame

Pairwise comparisons with Mann-Whitney rank test.

  • 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.

  • use_continuity (bool, optional) – Whether a continuity correction (1/2.) should be taken into account. Default is True.

  • alternative (['two-sided', 'less', or 'greater'], optional) – Whether to get the p-value for the one-sided hypothesis (‘less’ or ‘greater’) or for the two-sided hypothesis (‘two-sided’). Defaults to ‘two-sided’.

  • 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 or not. Recommended unless you sort your data manually.


result – P values.

Return type



Refer to scipy.stats.mannwhitneyu reference page for further details.


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