Python Numpy Array Group By Count In R