Count object in Tab Separated Array in Python 2.7 -


i have array of integer r = [ 242 302 377 ..., 1090 225 203]. count occurrences of 242 in r array. used count method this:

asd = r.count(242) print asd 

but gives me error

attributeerror: 'numpy.ndarray' object has no attribute 'count'.

how solve this?

the easiest way understand:

my_count = 0 in r:     if (i == 242):         my_count += 1 print my_count 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -