code: def prop_test(df):
      """
      Inspired from R package caret confusionMatrix.R
      """
      from scipy.stats import binom
  
      x = np.diag(df).sum()
      n = df.sum().sum()
      p = (df.sum(axis=0) / df.sum().sum()).max()
      d = {
          "statistic": x,  # number of successes
          "parameter": n,  # number of trials
          "null.value": p,  # probability of success
          "p.value": binom.sf(
              x - 1, n, p
          ),  # see https://en.wikipedia.org/wiki/Binomial_test
      }
      return d
  
imports: import numpy
  from pandas.compat import range
label_desc: Use image node_id 4 for calling a global function with example usage: prop_test(df) and returns: d