code: def makeBands(inputlist, numberOfBands):
      
      if numberOfBands < 2:
          return inputlist
      vmin = np.min(inputlist)
      vmax = np.max(inputlist)
      bb = np.linspace(vmin, vmax, numberOfBands, endpoint=0)
      dr = bb[1] - bb[0]
      bb += dr / 2
      tol = dr / 2 * 1.001
  
      newlist = []
      for s in inputlist:
          for b in bb:
              if abs(s - b) < tol:
                  newlist.append(b)
                  break
  
      return np.array(newlist)
docs: Group values of a list into bands of equal value.
  
      :param int numberOfBands: number of bands, a positive integer > 2.
      :return: a binned list of the same length as the input.