此函数用于将数组元素舍入到最接近的整数。
句法
numpy.rint(array)
参数
- 数组:要计算其最接近整数的数组元素。
返回
返回包含舍入值的数组。
例子
import numpy as np
arr = [0.23, 0.09, 1.2, 1.24, 9.99]
print("Input array:", arr)
r_arr = np.rint(arr)
print("Output array:", r_arr)
输出
Input array: [0.23, 0.09, 1.2, 1.24, 9.99]
Output array: [ 0. 0. 1. 1. 10.]
来源:
https://www.srcmini02.com/30865.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_35693.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57