compress(condition, a, axis=None)
This docstring was copied from numpy.compress.
Some inconsistencies with the Dask version may exist.
When working along a given axis, a slice along that axis is returned in :None:None:`output`
for each index where :None:None:`condition`
evaluates to True. When working on a 1-D array, compress
is equivalent to extract
.
Array that selects which entries to return. If len(condition) is less than the size of a
along the given axis, then output is truncated to the length of the condition array.
Array from which to extract a part.
Axis along which to take slices. If None (default), work on the flattened array.
Output array. Its type is preserved and it must be of the right shape to hold the output.
A copy of a
without the slices along axis for which :None:None:`condition`
is false.
Return selected slices of an array along given axis.
extract
Equivalent method when working on 1-D arrays
ndarray.compress
Equivalent method in ndarray
>>> a = np.array([[1, 2], [3, 4], [5, 6]]) # doctest: +SKIPThis example is valid syntax, but we were not able to check execution
... a # doctest: +SKIP array([[1, 2], [3, 4], [5, 6]])
>>> np.compress([0, 1], a, axis=0) # doctest: +SKIP array([[3, 4]])This example is valid syntax, but we were not able to check execution
>>> np.compress([False, True, True], a, axis=0) # doctest: +SKIP array([[3, 4], [5, 6]])This example is valid syntax, but we were not able to check execution
>>> np.compress([False, True], a, axis=1) # doctest: +SKIP array([[2], [4], [6]])
Working on the flattened array does not return slices along an axis but selects elements.
This example is valid syntax, but we were not able to check execution>>> np.compress([False, True], a) # doctest: +SKIP array([2])See :
The following pages refer to to this document either explicitly or contain code examples using this.
dask.array.routines.extract
dask.array.routines.select
dask.array.routines.take
dask.array.routines.compress
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