I have numpy ndarray strings and you want to find out how often a particular word appears in the array. I found this solution:
letters = numpy.array([["a","b"],["c","a"]]) print (numpy.count_nonzero(letters=="a"))
-> 2
I'm just wondering if this problem has not been resolved too complex or if this is the easiest solution, because there is a simple .count () for lists.
source share