Test whether all array elements along a given axis evaluate to True.
Parameters : | a : array_like
axis : None or int or tuple of ints, optional
out : ndarray, optional
keepdims : bool, optional
|
---|---|
Returns : | all : ndarray, bool
|
See also
Notes
Not a Number (NaN), positive infinity and negative infinity evaluate to True because these are not equal to zero.
Examples
>>> np.all([[True,False],[True,True]])
False
>>> np.all([[True,False],[True,True]], axis=0)
array([ True, False], dtype=bool)
>>> np.all([-1, 4, 5])
True
>>> np.all([1.0, np.nan])
True
>>> o=np.array([False])
>>> z=np.all([-1, 4, 5], out=o)
>>> id(z), id(o), z
(28293632, 28293632, array([ True], dtype=bool))