MaskedArray.compress(condition, axis=None, out=None)

Return a where condition is True. If condition is a MaskedArray, missing values are considered as False.


condition : var

Boolean 1-d array selecting which entries to return. If len(condition) is less than the size of a along the axis, then output is truncated to length of condition array.

axis : {None, int}, optional

Axis along which the operation must be performed.

out : {None, ndarray}, optional

Alternative output array in which to place the result. It must have the same shape as the expected output but the type will be cast if necessary.


result : MaskedArray

A MaskedArray object.


Please note the difference with compressed ! The output of compress has a mask, the output of compressed does not.

Previous topic

Next topic

This Page

Quick search