numpy.all(a,axis=None,out=None,keepdims=<class numpy._globals._NoValue>)[source]¶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
ndarray.allanyNotes
Not a Number (NaN), positive infinity and negative infinityevaluate toTrue 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))