dask 2021.10.0

ParametersReturnsBackRef
flatnonzero(a)

This docstring was copied from numpy.flatnonzero.

Some inconsistencies with the Dask version may exist.

This is equivalent to np.nonzero(np.ravel(a))[0].

Parameters

a : array_like

Input data.

Returns

res : ndarray

Output array, containing the indices of the elements of :None:None:`a.ravel()` that are non-zero.

Return indices that are non-zero in the flattened version of a.

See Also

nonzero

Return the indices of the non-zero elements of the input array.

ravel

Return a 1-D array containing the elements of the input array.

Examples

This example is valid syntax, but we were not able to check execution
>>> x = np.arange(-2, 3)  # doctest: +SKIP
... x # doctest: +SKIP array([-2, -1, 0, 1, 2])
This example is valid syntax, but we were not able to check execution
>>> np.flatnonzero(x)  # doctest: +SKIP
array([0, 1, 3, 4])

Use the indices of the non-zero elements as an index array to extract these elements:

This example is valid syntax, but we were not able to check execution
>>> x.ravel()[np.flatnonzero(x)]  # doctest: +SKIP
array([-2, -1,  1,  2])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

dask.array.routines.nonzero

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /dask/array/routines.py#2047
type: <class 'function'>
Commit: