code: def pairwise_gameshowell(
      data=None, dv=None, between=None, effsize="hedges"
  ):
      """Pairwise Games-Howell post-hoc test.
  
      Parameters
      ----------
      data : :py:class:`pandas.DataFrame`
          DataFrame
      dv : string
          Name of column containing the dependent variable.
      between: string
          Name of column containing the between factor.
      effsize : string or None
          Effect size type. Available methods are:
  
          * ``'none'``: no effect size
          * ``'cohen'``: Unbiased Cohen d
          * ``'hedges'``: Hedges g
          * ``'r'``: Pearson correlation coefficient
          * ``'eta-square'``: Eta-square
          * ``'odds-ratio'``: Odds ratio
          * ``'AUC'``: Area Under the Curve
          * ``'CLES'``: Common Language Effect Size
  
      Returns
      -------
      stats : :py:class:`pandas.DataFrame`
          Stats summary:
  
          * ``'A'``: Name of first measurement
          * ``'B'``: Name of second measurement
          * ``'mean(A)'``: Mean of first measurement
          * ``'mean(B)'``: Mean of second measurement
          * ``'diff'``: Mean difference (= mean(A) - mean(B))
          * ``'se'``: Standard error
          * ``'T'``: T-values
          * ``'df'``: adjusted degrees of freedom
          * ``'pval'``: Games-Howell corrected p-values
          * ``'hedges'``: Hedges effect size (or any effect size defined in
            ``effsize``)
  
      See also
      --------
      pairwise_tests, pairwise_tukey
  
      Notes
      -----
      Games-Howell [1]_ is very similar to the Tukey HSD post-hoc test but is much more robust to
      heterogeneity of variances. While the Tukey-HSD post-hoc is optimal after a classic one-way
      ANOVA, the Games-Howell is optimal after a Welch ANOVA. Please note that Games-Howell
      is not valid for repeated measures ANOVA. Only one-way ANOVA design are supported.
  
      Compared to the Tukey-HSD test, the Games-Howell test uses different pooled variances for
      each pair of variables instead of the same pooled variance.
  
      The T-values are defined as:
  
      .. math::
  
          t = \\frac{\\overline{x}_i - \\overline{x}_j}
          {\\sqrt{(\\frac{s_i^2}{n_i} + \\frac{s_j^2}{n_j})}}
  
      and the corrected degrees of freedom are:
  
      .. math::
  
          v = \\frac{(\\frac{s_i^2}{n_i} + \\frac{s_j^2}{n_j})^2}
          {\\frac{(\\frac{s_i^2}{n_i})^2}{n_i-1} +
          \\frac{(\\frac{s_j^2}{n_j})^2}{n_j-1}}
  
      where :math:`\\overline{x}_i`, :math:`s_i^2`, and :math:`n_i` are the mean, variance and sample
      size of the first group and :math:`\\overline{x}_j`, :math:`s_j^2`, and :math:`n_j` the mean,
      variance and sample size of the second group.
  
      The p-values are then approximated using the Studentized range distribution
      :math:`Q(\\sqrt2|t_i|, r, v_i)`.
  
      References
      ----------
      .. [1] Games, Paul A., and John F. Howell. "Pairwise multiple comparison
             procedures with unequal n's and/or variances: a Monte Carlo study."
             Journal of Educational Statistics 1.2 (1976): 113-125.
  
      .. [2] Gleason, John R. "An accurate, non-iterative approximation for
             studentized range quantiles." Computational statistics & data
             analysis 31.2 (1999): 147-158.
  
      Examples
      --------
      Pairwise Games-Howell post-hocs on the Penguins dataset.
  
      >>> import pingouin as pg
      >>> df = pg.read_dataset('penguins')
      >>> pg.pairwise_gameshowell(data=df, dv='body_mass_g',
      ...                         between='species').round(3)
                 A          B   mean(A)   mean(B)      diff      se       T       df  pval  hedges
      0     Adelie  Chinstrap  3700.662  3733.088   -32.426  59.706  -0.543  152.455  0.85  -0.074
      1     Adelie     Gentoo  3700.662  5076.016 -1375.354  58.811 -23.386  249.643  0.00  -2.860
      2  Chinstrap     Gentoo  3733.088  5076.016 -1342.928  65.103 -20.628  170.404  0.00  -2.875
      """
      # Check the dataframe
      data = _check_dataframe(
          dv=dv, between=between, effects="between", data=data
      )
  
      # Reset index (avoid duplicate axis error)
      data = data.reset_index(drop=True)
  
      # Extract infos
      ng = data[between].nunique()
      grp = data.groupby(between, observed=True)[
          dv
      ]  # default is sort=True
      # Careful: pd.unique does NOT sort whereas numpy does
      # The line below should be equal to labels = np.unique(data[between])
      # However, this does not work if between is a Categorical column, because
      # Pandas applies a custom, not alphabetical, sorting.
      # See https://github.com/raphaelvallat/pingouin/issues/111
      labels = np.array(list(grp.groups.keys()))
      n = grp.count().to_numpy()
      gmeans = grp.mean(numeric_only=True).to_numpy()
      gvars = grp.var(
          numeric_only=True
      ).to_numpy()  # numeric_only=True added in pandas 1.5
  
      # Pairwise combinations
      g1, g2 = np.array(list(combinations(np.arange(ng), 2))).T
      mn = gmeans[g1] - gmeans[g2]
      se = np.sqrt(gvars[g1] / n[g1] + gvars[g2] / n[g2])
      tval = mn / np.sqrt(gvars[g1] / n[g1] + gvars[g2] / n[g2])
      df = (gvars[g1] / n[g1] + gvars[g2] / n[g2]) ** 2 / (
          (((gvars[g1] / n[g1]) ** 2) / (n[g1] - 1))
          + (((gvars[g2] / n[g2]) ** 2) / (n[g2] - 1))
      )
  
      # Compute corrected p-values
      pval = studentized_range.sf(np.sqrt(2) * np.abs(tval), ng, df)
      pval = np.clip(pval, 0, 1)
  
      # Uncorrected p-values
      # from scipy.stats import t
      # punc = t.sf(np.abs(tval), n[g1].size + n[g2].size - 2) * 2
  
      # Effect size
      # Method 1: Approximation
      # d = tval * np.sqrt(1 / n[g1] + 1 / n[g2])
      # ef = convert_effsize(d, "cohen", effsize, n[g1], n[g2])
      # Method 2: Exact
      ef = []
      for idx_a, idx_b in zip(g1, g2):
          ef.append(
              compute_effsize(
                  grp.get_group(labels[idx_a]),
                  grp.get_group(labels[idx_b]),
                  paired=False,
                  eftype=effsize,
              )
          )
  
      # Create dataframe
      stats = pd.DataFrame(
          {
              "A": labels[g1],
              "B": labels[g2],
              "mean(A)": gmeans[g1],
              "mean(B)": gmeans[g2],
              "diff": mn,
              "se": se,
              "T": tval,
              "df": df,
              "pval": pval,
              effsize: ef,
          }
      )
      return _postprocess_dataframe(stats)
  
file_path: pingouin/pingouin/pairwise.py
imports: import numpy
  import pandas
  import pandas_flavor
  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 scipy.stats import studentized_range
  import warnings
label_desc: Use image node_id 5 for calling a global function with example usage: pairwise_gameshowell(data, dv, between, effsize) and returns: _postprocess_dataframe