开发者

count the number of integers in an array

开发者 https://www.devze.com 2023-03-15 02:33 出处:网络
I\'m sure this is a really simple question, but I can\'t seem to find the answer. How can I get a count on the number of integers in a numpy array? I suspect there is a built-in count() method? Here i

I'm sure this is a really simple question, but I can't seem to find the answer. How can I get a count on the number of integers in a numpy array? I suspect there is a built-in count() method? Here is an example of开发者_运维技巧 what I am looking for:

>>> x = numpy.array([1, 2, 3, 4, 5])

>>> numpy.count(x)

5

Thanks for the help!


size provides the number of elements in an array. e.g. x.size

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号