The Python Oracle

How do I count the occurrence of a certain item in an ndarray?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Secret Catacombs

--

Chapters
00:00 Question
00:31 Accepted answer (Score 996)
01:01 Answer 2 (Score 426)
01:20 Answer 3 (Score 191)
01:40 Answer 4 (Score 65)
01:58 Thank you

--

Full question
https://stackoverflow.com/questions/2866...

Accepted answer links:
[numpy.unique]: https://numpy.org/doc/stable/reference/g...
[collections.Counter]: https://docs.python.org/2/library/collec...

Answer 2 links:
[numpy.count_nonzero]: https://docs.scipy.org/doc/numpy-1.13.0/...

Answer 4 links:
[numpy.bincount]: http://docs.scipy.org/doc/numpy/referenc...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #numpy #multidimensionalarray #count

#avk47