code: def __convert_to_df(
      a: Union[list, np.ndarray, DataFrame],
      val_col: str = "vals",
      group_col: str = "groups",
      val_id: int = None,
      group_id: int = None,
  ) -> Tuple[DataFrame, str, str]:
      """Hidden helper method to create a DataFrame with input data for further
      processing.
  
      Parameters
      ----------
      a : Union[list, np.ndarray, DataFrame]
          An array, any object exposing array interface or a pandas DataFrame.
          Array must be two-dimensional. Second dimension may vary, i.e. groups
          may have different lengths.
  
      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.
  
      val_id : int, optional
          Index of a column that contains dependent variable values (test or
          response variable). Should be specified if a NumPy ndarray is used as an
          input. It will be inferred from data, if not specified.
  
      group_id : int, optional
          Index of a column that contains independent variable values (grouping or
          predictor variable). Should be specified if a NumPy ndarray is used as
          an input. It will be inferred from data, if not specified.
  
      Returns
      -------
      Tuple[DataFrame, str, str]
          Returns a tuple of DataFrame and two strings:
          - DataFrame with input data, `val_col` column contains numerical values
            and `group_col` column contains categorical values.
          - Name of a DataFrame column that contains dependent variable values
            (test or response variable).
          - Name of a DataFrame column that contains independent variable values
            (grouping or predictor variable).
  
      Notes
      -----
      Inferrence algorithm for determining `val_id` and `group_id` args is rather
      simple, so it is better to specify them explicitly to prevent errors.
      """
      if not group_col:
          group_col = "groups"
      if not val_col:
          val_col = "vals"
  
      if isinstance(a, DataFrame):
          x = a.copy()
          if not {group_col, val_col}.issubset(a.columns):
              raise ValueError(
                  "Specify correct column names using `group_col` and `val_col` args"
              )
          return x, val_col, group_col
  
      elif isinstance(a, list) or (
          isinstance(a, np.ndarray) and not a.shape.count(2)
      ):
          grps_len = map(len, a)
          grps = list(
              it.chain(*[[i + 1] * l for i, l in enumerate(grps_len)])
          )
          vals = list(it.chain(*a))
  
          return (
              DataFrame({val_col: vals, group_col: grps}),
              val_col,
              group_col,
          )
  
      elif isinstance(a, np.ndarray):
          # cols ids not defined
          # trying to infer
          if not all([val_id, group_id]):
              if np.argmax(a.shape):
                  a = a.T
  
              ax = [np.unique(a[:, 0]).size, np.unique(a[:, 1]).size]
  
              if np.diff(ax).item():
                  __val_col = np.argmax(ax)
                  __group_col = np.argmin(ax)
              else:
                  raise ValueError(
                      "Cannot infer input format.\nPlease specify `val_id` and `group_id` args"
                  )
  
              cols = {__val_col: val_col, __group_col: group_col}
          else:
              cols = {val_id: val_col, group_id: group_col}
  
          cols_vals = dict(sorted(cols.items())).values()
          return DataFrame(a, columns=cols_vals), val_col, group_col
  
imports: import itertools
  from typing import Tuple, Union
  import numpy
  import scipy.stats
  from statsmodels.sandbox.stats.multicomp import multipletests
  from statsmodels.stats.multicomp import pairwise_tukeyhsd
  from statsmodels.stats.libqsturng import psturng
  from pandas import DataFrame
label_desc: Use image node_id 1 for calling a global function with example usage: __convert_to_df(a, val_col, group_col, val_id, group_id) and returns: x,  val_col,  group_col, DataFrame,  val_col,  group_col, DataFrame,  val_col,  group_col