code: def count_table(*keys):
      
      indices  = [as_index(k, axis=0) for k in keys]
      uniques  = [i.unique  for i in indices]
      inverses = [i.inverse for i in indices]
      shape    = [i.groups  for i in indices]
      table = np.zeros(shape, np.int)
      np.add.at(table, inverses, 1)
      return tuple(uniques), table
docs: count the number of times each key occurs in the input set
  
      Arguments
      ---------
      keys : tuple of indexable objects, each having the same number of items
  
      Returns
      -------
      unique : tuple of ndarray, [groups, ...]
          unique keys for each input item
          they form the axes labels of the table
      table : ndarray, [keys[0].groups, ... keys[n].groups], int
          the number of times each key-combination occurs in the input set
  
      Notes
      -----
      Equivalent to R's pivot table or pandas 'crosstab'
      Alternatively, dense equivalent of the count function
      Should we add weights option?
      Or better yet; what about general reductions over key-grids?