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 ---
(self, decimals=0, out=None)
| 5568 | return dvar |
| 5569 | |
| 5570 | def round(self, decimals=0, out=None): |
| 5571 | """ |
| 5572 | Return each element rounded to the given number of decimals. |
| 5573 | |
| 5574 | Refer to `numpy.around` for full documentation. |
| 5575 | |
| 5576 | See Also |
| 5577 | -------- |
| 5578 | numpy.ndarray.round : corresponding function for ndarrays |
| 5579 | numpy.around : equivalent function |
| 5580 | |
| 5581 | Examples |
| 5582 | -------- |
| 5583 | >>> import numpy as np |
| 5584 | >>> import numpy.ma as ma |
| 5585 | >>> x = ma.array([1.35, 2.5, 1.5, 1.75, 2.25, 2.75], |
| 5586 | ... mask=[0, 0, 0, 1, 0, 0]) |
| 5587 | >>> ma.round(x) |
| 5588 | masked_array(data=[1.0, 2.0, 2.0, --, 2.0, 3.0], |
| 5589 | mask=[False, False, False, True, False, False], |
| 5590 | fill_value=1e+20) |
| 5591 | |
| 5592 | """ |
| 5593 | result = self._data.round(decimals=decimals, out=out).view(type(self)) |
| 5594 | if result.ndim > 0: |
| 5595 | result._mask = self._mask |
| 5596 | result._update_from(self) |
| 5597 | elif self._mask: |
| 5598 | # Return masked when the scalar is masked |
| 5599 | result = masked |
| 5600 | # No explicit output: we're done |
| 5601 | if out is None: |
| 5602 | return result |
| 5603 | if isinstance(out, MaskedArray): |
| 5604 | out.__setmask__(self._mask) |
| 5605 | return out |
| 5606 | |
| 5607 | def argsort(self, axis=np._NoValue, kind=None, order=None, endwith=True, |
| 5608 | fill_value=None, *, stable=False, descending=False): |