NumPy

Previous topic

numpy.ma.MaskedArray.product

Next topic

numpy.ma.MaskedArray.round

numpy.ma.MaskedArray.ptp

method

MaskedArray.ptp(self, axis=None, out=None, fill_value=None, keepdims=False)[source]

Return (maximum - minimum) along the given dimension (i.e. peak-to-peak value).

Parameters
axis{None, int}, optional

Axis along which to find the peaks. If None (default) the flattened array is used.

out{None, array_like}, optional

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

fill_value{var}, optional

Value used to fill in the masked values.

keepdimsbool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the array.

Returns
ptpndarray.

A new array holding the result, unless out was specified, in which case a reference to out is returned.