from collections import Counter
z = ['blue', 'red', 'blue', 'yellow', 'blue', 'red']
Counter(z)
# Counter({'blue': 3, 'red': 2, 'yellow': 1})
# And to output as a dataframe
condition_counts = pd.DataFrame.from_dict(Counter(image_sets_shown), orient='index')