This is an archival dump of old wiki content --- see scipy.org for current material

Abstract

If any elements are true in the given array, True is returned.

Signature


Function

any(arr)

Method

arr.any()


Returns

return

True if any element in the array is true.

Arguments

arr
input array

Details

xxx

Examples

   1 >>> from numpy import *
   2 >>> a = array([True, False, True])
   3 >>> a.any()                                 # gives True if at least 1 element of a is True, otherwise False
   4 True
   5 >>> any(a)                                  # this form also exists
   6 True
   7 >>> a = array([1,2,3])
   8 >>> (a >= 1).any()                          # equivalent to any(a >= 1)
   9 True

Notes

xxx

See Also

all alltrue sometrue

SciPy: any (last edited 2015-10-24 17:48:23 by anonymous)