Python Programming - Arrays - Discussion

Discussion Forum : Arrays - General Questions (Q.No. 56)
56.
How can you check if all elements in a NumPy array arr are non-zero?
np.nonzero(arr)
np.all(arr != 0)
arr.all_nonzero()
arr.is_nonzero()
Answer: Option
Explanation:
The code np.all(arr != 0) checks if all elements in the array are non-zero.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.