的主要区别在于,round为ufunc所述的ndarray类,而np.around是一个模块级功能。
从功能上讲,它们是等效的,因为它们做同样的事情——将浮点数均匀地舍入到最接近的整数。从其源代码中ndarray.round调用around。
def round_(a, decimals=0, out=None):
"""
Round an array to the given number of decimals.
Refer to `around` for full documentation.
See Also
--------
around : equivalent function
"""
return around(a, decimals=decimals, out=out)
Run Code Online (Sandbox Code Playgroud)