Given an numpy array a
, I can use np.unique(a) to generate the unique values included in a
. How can I get the count of each unique values included in a
?
Asked
Active
Viewed 97 times
1

cs95
- 379,657
- 97
- 704
- 746

user297850
- 7,705
- 17
- 54
- 76
-
1If you want the *count* of each unique element, you can use `from collections import Counter` then `print(Counter(a))` – rafaelc May 13 '18 at 02:12