Return selected slices of an array along given axis.
Parameters: | condition : array_like
a : array_like
axis : int, optional
out : ndarray, optional
|
---|---|
Returns: | compressed_array : ndarray
|
See also
Examples
>>> a = np.array([[1, 2], [3, 4]])
>>> np.compress([0, 1], a, axis=0)
array([[3, 4]])
>>> np.compress([1], a, axis=1)
array([[1],
[3]])
>>> np.compress([0,1,1], a)
array([2, 3])