drbunsen
drbunsen

Reputation: 10709

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!

Upvotes: 0

Views: 625

Answers (1)

Blake Mathman
Blake Mathman

Reputation: 2749

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

Upvotes: 3

Related Questions