numpy.ma.MaskedArray.compress

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

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

Parameters:

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.

Returns:

result : MaskedArray

A MaskedArray object.

Warning

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

Previous topic

numpy.ma.MaskedArray.choose

Next topic

numpy.ma.MaskedArray.diagonal

This Page

Quick search