numpy.ma.MaskedArray.round#

method

ma.MaskedArray.round(decimals=0, out=None)[source]#

Return each element rounded to the given number of decimals.

Refer to numpy.around for full documentation.

See also

numpy.ndarray.round

corresponding function for ndarrays

numpy.around

equivalent function

Examples

>>> import numpy.ma as ma
>>> x = ma.array([1.35, 2.5, 1.5, 1.75, 2.25, 2.75],
...              mask=[0, 0, 0, 1, 0, 0])
>>> ma.round(x)
masked_array(data=[1.0, 2.0, 2.0, --, 2.0, 3.0],
             mask=[False, False, False,  True, False, False],
        fill_value=1e+20)