Numpy Count Number Of Occurrences In R