code: def binC(y, bins):
      
  
      if np.ndim(y) == 1:
          k = 1
          n = np.shape(y)[0]
      else:
          n, k = np.shape(y)
      b = np.zeros((n, k), dtype='int')
      for i, bin in enumerate(bins):
          b[np.nonzero(y == bin)] = i
  
      # check for non-binned items and warn if needed
      vals = set(y.flatten())
      for val in vals:
          if val not in bins:
              Warn('value not in bin: {}'.format(val), UserWarning)
              Warn('bins: {}'.format(bins), UserWarning)
  
      return b
docs: Bin categorical/qualitative data
  
      Parameters
      ----------
      y    : array
             (n,q), categorical values
      bins : array
             (k,1),  unique values associated with each bin
  
      Return
      ------
      b : array
          (n,q), bin membership, values between 0 and k-1
  
      Examples
      --------
      >>> import numpy as np
      >>> import mapclassify as mc
      >>> np.random.seed(1)
      >>> x = np.random.randint(2, 8, (10, 3))
      >>> bins = list(range(2, 8))
      >>> x
      array([[7, 5, 6],
             [2, 3, 5],
             [7, 2, 2],
             [3, 6, 7],
             [6, 3, 4],
             [6, 7, 4],
             [6, 5, 6],
             [4, 6, 7],
             [4, 6, 3],
             [3, 2, 7]])
      >>> y = mc.classifiers.binC(x, bins)
      >>> y
      array([[5, 3, 4],
             [0, 1, 3],
             [5, 0, 0],
             [1, 4, 5],
             [4, 1, 2],
             [4, 5, 2],
             [4, 3, 4],
             [2, 4, 5],
             [2, 4, 1],
             [1, 0, 5]])