code: def mwu(x, y, alternative="two-sided", **kwargs):
      """Mann-Whitney U Test (= Wilcoxon rank-sum test). It is the non-parametric
      version of the independent T-test.
  
      Parameters
      ----------
      x, y : array_like
          First and second set of observations. ``x`` and ``y`` must be
          independent.
      alternative : string
          Defines the alternative hypothesis, or tail of the test. Must be one of
          "two-sided" (default), "greater" or "less". See :py:func:`scipy.stats.mannwhitneyu` for
          more details.
      **kwargs : dict
          Additional keywords arguments that are passed to :py:func:`scipy.stats.mannwhitneyu`.
  
      Returns
      -------
      stats : :py:class:`pandas.DataFrame`
  
          * ``'U-val'``: U-value
          * ``'alternative'``: tail of the test
          * ``'p-val'``: p-value
          * ``'RBC'``   : rank-biserial correlation
          * ``'CLES'``  : common language effect size
  
      See also
      --------
      scipy.stats.mannwhitneyu, wilcoxon, ttest
  
      Notes
      -----
      The Mann–Whitney U test [1]_ (also called Wilcoxon rank-sum test) is a
      non-parametric test of the null hypothesis that it is equally likely that
      a randomly selected value from one sample will be less than or greater
      than a randomly selected value from a second sample. The test assumes
      that the two samples are independent. This test corrects for ties and by
      default uses a continuity correction (see :py:func:`scipy.stats.mannwhitneyu` for details).
  
      The rank biserial correlation [2]_ is the difference between
      the proportion of favorable evidence minus the proportion of unfavorable
      evidence.
  
      The common language effect size is the proportion of pairs where ``x`` is
      higher than ``y``. It was first introduced by McGraw and Wong (1992) [3]_.
      Pingouin uses a brute-force version of the formula given by Vargha and
      Delaney 2000 [4]_:
  
      .. math:: \\text{CL} = P(X > Y) + .5 \\times P(X = Y)
  
      The advantage is of this method are twofold. First, the brute-force
      approach pairs each observation of ``x`` to its ``y`` counterpart, and
      therefore does not require normally distributed data. Second, the formula
      takes ties into account and therefore works with ordinal data.
  
      When tail is ``'less'``, the CLES is then set to :math:`1 - \\text{CL}`,
      which gives the proportion of pairs where ``x`` is *lower* than ``y``.
  
      References
      ----------
      .. [1] Mann, H. B., & Whitney, D. R. (1947). On a test of whether one of
             two random variables is stochastically larger than the other.
             The annals of mathematical statistics, 50-60.
  
      .. [2] Kerby, D. S. (2014). The simple difference formula: An approach to
             teaching nonparametric correlation. Comprehensive Psychology,
             3, 11-IT.
  
      .. [3] McGraw, K. O., & Wong, S. P. (1992). A common language effect size
             statistic. Psychological bulletin, 111(2), 361.
  
      .. [4] Vargha, A., & Delaney, H. D. (2000). A Critique and Improvement of
          the “CL” Common Language Effect Size Statistics of McGraw and Wong.
          Journal of Educational and Behavioral Statistics: A Quarterly
          Publication Sponsored by the American Educational Research
          Association and the American Statistical Association, 25(2),
          101–132. https://doi.org/10.2307/1165329
  
      Examples
      --------
      >>> import numpy as np
      >>> import pingouin as pg
      >>> np.random.seed(123)
      >>> x = np.random.uniform(low=0, high=1, size=20)
      >>> y = np.random.uniform(low=0.2, high=1.2, size=20)
      >>> pg.mwu(x, y, alternative='two-sided')
           U-val alternative    p-val    RBC    CLES
      MWU   97.0   two-sided  0.00556  0.515  0.2425
  
      Compare with SciPy
  
      >>> import scipy
      >>> scipy.stats.mannwhitneyu(x, y, use_continuity=True, alternative='two-sided')
      MannwhitneyuResult(statistic=97.0, pvalue=0.0055604599321374135)
  
      One-sided test
  
      >>> pg.mwu(x, y, alternative='greater')
           U-val alternative     p-val    RBC    CLES
      MWU   97.0     greater  0.997442  0.515  0.2425
  
      >>> pg.mwu(x, y, alternative='less')
           U-val alternative    p-val    RBC    CLES
      MWU   97.0        less  0.00278  0.515  0.7575
  
      Passing keyword arguments to :py:func:`scipy.stats.mannwhitneyu`:
  
      >>> pg.mwu(x, y, alternative='two-sided', method='exact')
           U-val alternative     p-val    RBC    CLES
      MWU   97.0   two-sided  0.004681  0.515  0.2425
      """
      x = np.asarray(x)
      y = np.asarray(y)
  
      # Remove NA
      x, y = remove_na(x, y, paired=False)
  
      # Check tails
      assert alternative in [
          "two-sided",
          "greater",
          "less",
      ], "Alternative must be one of 'two-sided' (default), 'greater' or 'less'."
      if "tail" in kwargs:
          raise ValueError(
              "Since Pingouin 0.4.0, the 'tail' argument has been renamed to 'alternative'."
          )
      uval, pval = scipy.stats.mannwhitneyu(
          x, y, alternative=alternative, **kwargs
      )
  
      # Effect size 1: Common Language Effect Size
      # CLES is tail-specific and calculated according to the formula given in
      # Vargha and Delaney 2000 which works with ordinal data.
      diff = x[:, None] - y
      # cles = max((diff < 0).sum(), (diff > 0).sum()) / diff.size
      # Tail = 'greater', with ties set to 0.5
      # Note that tail = 'two-sided' gives same output as tail = 'greater'
      cles = np.where(diff == 0, 0.5, diff > 0).mean()
      cles = 1 - cles if alternative == "less" else cles
  
      # Effect size 2: rank biserial correlation (Wendt 1972)
      rbc = 1 - (2 * uval) / diff.size  # diff.size = x.size * y.size
  
      # Fill output DataFrame
      stats = pd.DataFrame(
          {
              "U-val": uval,
              "alternative": alternative,
              "p-val": pval,
              "RBC": rbc,
              "CLES": cles,
          },
          index=["MWU"],
      )
      return _postprocess_dataframe(stats)
  
file_path: pingouin/pingouin/nonparametric.py
imports: import scipy
  import numpy
  import pandas
  from pingouin import remove_na, _check_dataframe, _postprocess_dataframe
label_desc: Use image node_id 3 for calling a global function with example usage: mwu(x, y, alternative) and returns: _postprocess_dataframe