MCPcopy Create free account
hub / github.com/numpy/numpy / round

Method round

numpy/ma/core.py:5486–5509  ·  view source on GitHub ↗

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

(self, decimals=0, out=None)

Source from the content-addressed store, hash-verified

5484 return dvar
5485
5486 def round(self, decimals=0, out=None):
5487 """
5488 Return each element rounded to the given number of decimals.
5489
5490 Refer to `numpy.around` for full documentation.
5491
5492 See Also
5493 --------
5494 numpy.ndarray.round : corresponding function for ndarrays
5495 numpy.around : equivalent function
5496 """
5497 result = self._data.round(decimals=decimals, out=out).view(type(self))
5498 if result.ndim > 0:
5499 result._mask = self._mask
5500 result._update_from(self)
5501 elif self._mask:
5502 # Return masked when the scalar is masked
5503 result = masked
5504 # No explicit output: we're done
5505 if out is None:
5506 return result
5507 if isinstance(out, MaskedArray):
5508 out.__setmask__(self._mask)
5509 return out
5510
5511 def argsort(self, axis=np._NoValue, kind=None, order=None,
5512 endwith=True, fill_value=None):

Callers 15

performance.pyFile · 0.80
test_attributesMethod · 0.80
check_roundMethod · 0.80
test_roundMethod · 0.80
_round_if_neededFunction · 0.80
_as_pairsFunction · 0.80
test_scott_vs_stoneMethod · 0.80
ndarray_misc.pyFile · 0.80
test_2dMethod · 0.80
test_roundMethod · 0.80

Calls 3

_update_fromMethod · 0.80
__setmask__Method · 0.80
viewMethod · 0.45

Tested by 10

test_attributesMethod · 0.64
check_roundMethod · 0.64
test_roundMethod · 0.64
test_scott_vs_stoneMethod · 0.64
test_2dMethod · 0.64
test_roundMethod · 0.64