countif in python code example Example: count values python from collections import Counter values=np.ones(10) Counter(values)