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
Post a Comment