开发者

count the number of integers in an array

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜