numpy.ma.MaskedArray.round#
method
- ma.MaskedArray.round(decimals=0, out=None)[源代码]#
返回每个元素四舍五入到给定小数位后的值.
完整文档请参考
numpy.around.参见
numpy.ndarray.roundndarrays 对应的函数
numpy.around等效函数
示例
>>> import numpy as np >>> 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)