此函数用于将数组值四舍五入为零附近的整数。
句法
numpy.fix(array, b = None)
参数
- 数组:要舍入的数组元素。
- b:这是一个可选的Ndarray。
返回
返回包含舍入值的数组。
例子
import numpy as np
arr = [0.23, 0.09, 1.2, 1.24, 9.99]
print("Input array:", arr)
r_arr = np.fix(arr)
print("Output array:", r_arr)
输出
Input array: [0.23, 0.09, 1.2, 1.24, 9.99]
Output array: [0. 0. 1. 1. 9.]
来源:
https://www.srcmini02.com/30811.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_35709.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57