code: def descstats(data, cols=None, axis=0):
      """
      Prints descriptive statistics for one or multiple variables.
  
      Parameters
      ----------
      data: numpy array
          `x` is the data
  
      v: list, optional
          A list of the column number of variables.
          Default is all columns.
  
      axis: 1 or 0
          axis order of data.  Default is 0 for column-ordered data.
  
      Examples
      --------
      >>> descstats(data.exog,v=['x_1','x_2','x_3'])
      """
  
      x = np.array(data)  # or rather, the data we're interested in
      if cols is None:
          x = x[:, None]
      if cols is None and x.ndim == 1:
          x = x[:, None]
  
      if x.shape[1] == 1:
          desc = """
      ---------------------------------------------
      Univariate Descriptive Statistics
      ---------------------------------------------
  
      Var. Name   %(name)12s
      ----------
      Obs.          %(nobs)22i  Range                  %(range)22s
      Sum of Wts.   %(sum)22s  Coeff. of Variation     %(coeffvar)22.4g
      Mode          %(mode)22.4g  Skewness                %(skewness)22.4g
      Repeats       %(nmode)22i  Kurtosis                %(kurtosis)22.4g
      Mean          %(mean)22.4g  Uncorrected SS          %(uss)22.4g
      Median        %(median)22.4g  Corrected SS            %(ss)22.4g
      Variance      %(variance)22.4g  Sum Observations        %(sobs)22.4g
      Std. Dev.     %(stddev)22.4g
      """ % {
              "name": cols,
              "sum": "N/A",
              "nobs": len(x),
              "mode": stats.mode(x)[0][0],
              "nmode": stats.mode(x)[1][0],
              "mean": x.mean(),
              "median": np.median(x),
              "range": "(" + str(x.min()) + ", " + str(x.max()) + ")",
              "variance": x.var(),
              "stddev": x.std(),
              "coeffvar": stats.variation(x),
              "skewness": stats.skew(x),
              "kurtosis": stats.kurtosis(x),
              "uss": np.sum(x**2, axis=0),
              "ss": np.sum((x - x.mean()) ** 2, axis=0),
              "sobs": np.sum(x),
          }
  
          desc += """
  
      Percentiles
      -------------
      1  %%          %12.4g
      5  %%          %12.4g
      10 %%          %12.4g
      25 %%          %12.4g
  
      50 %%          %12.4g
  
      75 %%          %12.4g
      90 %%          %12.4g
      95 %%          %12.4g
      99 %%          %12.4g
      """ % tuple(
              [
                  stats.scoreatpercentile(x, per)
                  for per in (1, 5, 10, 25, 50, 75, 90, 95, 99)
              ]
          )
          t, p_t = stats.ttest_1samp(x, 0)
          M, p_M = sign_test(x)
          S, p_S = stats.wilcoxon(np.squeeze(x))
  
          desc += """
  
      Tests of Location (H0: Mu0=0)
      -----------------------------
      Test                Statistic       Two-tailed probability
      -----------------+-----------------------------------------
      Student's t      |  t {:7.5f}   Pr > |t|   <{:.4f}
      Sign             |  M {:8.2f}   Pr >= |M|  <{:.4f}
      Signed Rank      |  S {:8.2f}   Pr >= |S|  <{:.4f}
  
      """.format(
              t, p_t, M, p_M, S, p_S
          )
      # Should this be part of a 'descstats'
      # in any event these should be split up, so that they can be called
      # individually and only returned together if someone calls summary
      # or something of the sort
  
      elif x.shape[1] > 1:
          desc = (
              """
      Var. Name   |     Obs.        Mean    Std. Dev.           Range
      ------------+--------------------------------------------------------"""
              + os.linesep
          )
  
          for var in range(x.shape[1]):
              xv = x[:, var]
              kwargs = {
                  "name": var,
                  "obs": len(xv),
                  "mean": xv.mean(),
                  "stddev": xv.std(),
                  "range": "("
                  + str(xv.min())
                  + ", "
                  + str(xv.max())
                  + ")"
                  + os.linesep,
              }
              desc += (
                  "%(name)15s %(obs)9i %(mean)12.4g %(stddev)12.4g "
                  "%(range)20s" % kwargs
              )
      else:
          raise ValueError("data not understood")
  
      return desc
  
imports: import os
  import numpy
  from scipy import stats
  from statsmodels.stats.descriptivestats import sign_test
label_desc: Use image node_id 1 for calling a global function with example usage: descstats(data, cols, axis) and returns: desc