dask 2021.10.0

ParametersReturnsBackRef
extract(condition, arr)

This docstring was copied from numpy.extract.

Some inconsistencies with the Dask version may exist.

This is equivalent to np.compress(ravel(condition), ravel(arr)) . If :None:None:`condition` is boolean np.extract is equivalent to arr[condition] .

Note that :None:None:`place` does the exact opposite of extract .

Parameters

condition : array_like

An array whose nonzero or True entries indicate the elements of :None:None:`arr` to extract.

arr : array_like

Input array of the same size as :None:None:`condition`.

Returns

extract : ndarray

Rank 1 array of values from :None:None:`arr` where :None:None:`condition` is True.

Return the elements of an array that satisfy some condition.

See Also

compress
copyto
place
put
take

Examples

This example is valid syntax, but we were not able to check execution
>>> arr = np.arange(12).reshape((3, 4))  # doctest: +SKIP
... arr # doctest: +SKIP array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]])
This example is valid syntax, but we were not able to check execution
>>> condition = np.mod(arr, 3)==0  # doctest: +SKIP
... condition # doctest: +SKIP array([[ True, False, False, True], [False, False, True, False], [False, True, False, False]])
This example is valid syntax, but we were not able to check execution
>>> np.extract(condition, arr)  # doctest: +SKIP
array([0, 3, 6, 9])

If :None:None:`condition` is boolean:

This example is valid syntax, but we were not able to check execution
>>> arr[condition]  # doctest: +SKIP
array([0, 3, 6, 9])
See :

Back References

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

dask.array.routines.extract dask.array.routines.compress

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#1909
type: <class 'function'>
Commit: