code: def shannoninfo(px, logbase=2):
      """
      Shannon's information
  
      Parameters
      ----------
      px : float or array_like
          `px` is a discrete probability distribution
  
      Returns
      -------
      For logbase = 2
      np.log2(px)
      """
      px = np.asarray(px)
      if not np.all(px <= 1) or not np.all(px >= 0):
          raise ValueError("px does not define proper distribution")
      if logbase != 2:
          return -logbasechange(2, logbase) * np.log2(px)
      else:
          return -np.log2(px)
  
file_path: statsmodels/statsmodels/sandbox/infotheo.py
imports: from statsmodels.compat.python import lzip, lmap
  from scipy import stats
  import numpy
  from matplotlib import pyplot
  from scipy.special import logsumexp
label_desc: Use image node_id 8 for calling a global function with example usage: shannoninfo(px, logbase) and returns: unknown, unknown