Labels are ["a", "b", "a", "a", "b"]. Print the unique labels, then print how many times each one appears. np.unique(..., return_counts=True) returns both.
Data analysis labNumPy problems
Problem 41 of 50 · Order · Medium
How often each label appears
Count unique labels in one pass.
Preparing NumPy, Pandas, and MatplotlibShift+Enter runs the cell you are in.
1
Your solution
2