code: def _fast_count_smallints(arr):
      
      counts = np.bincount(arr.astype(np.int_))
      nz = counts.nonzero()[0]
      return np.c_[nz, counts[nz]]
docs: Faster version of set(arr) for sequences of small numbers.