Zero array elements
Function nonzero(V)
The result is a tuple of arrays. Each such array corresponds to a separate axis of the original array and contains indices with non-zero elements in this array.
V
- a
NumPy array or array-like object.
Returns a Python tuple (
tuple) - tuple with arrays of indexes of non-zero elements of the original array
V
.
Function count_nonzero(V)
This function is based on the built-in
__bool__()
method of Python objects that checks whether they are true. It follows that the
count_nonzero()
function is actually able to work not only with numbers, but also with any objects that can be either true or false.
V
- a
NumPy array or array-like object.
The function returns the number of non-zero array elements along the specified axis.