def unique_rows_counts(a):
    lidx = np.ravel_multi_index(a.T, a.max(0) + 1)
_, unq_idx, counts = np.unique(lidx, return_index=True, return_counts=True)
return a[unq_idx], counts

def map_Counter(a):
    return Counter(map(tuple, a))

def forloop_Counter(a):
    c = Counter()
for x in a:
    c[tuple(x)] += 1
return c
count occurrences of arrays in multidimensional arrays in python