当前位置:网站首页>The round functions in the np, ceil function and floor function
The round functions in the np, ceil function and floor function
2022-08-09 23:11:00 【phac123】
np.round()
import numpy as np
x = [10.7, 10.5, 10.3, 11.7, 11.5, 11.3, 0.7, 0.5, 0.3]
y = np.round(x)
print(y)
- np.round()The meaning of function is round.In the theory of error,Even when the integer part of,小数部分是0.5时,向下取整;When the integer part is odd,小数部分是0.5时,则向上取整.也就是说,When the decimal part is0.5的时候,“Go odd save even”,Such results are statistically more accurate.numpy的roundFunction using that method was.
np.ceil()*
import numpy as np
x = [10.7, 10.5, 10.3, 11.7, 11.5, 11.3, 0.7, 0.5, 0.3]
y = np.ceil(x)
print(y)
- 向上取整
np.floor()
import numpy as np
x = [10.7, 10.5, 10.3, 11.7, 11.5, 11.3, 0.7, 0.5, 0.3]
y = np.floor(x)
print(y)
- 向下取整
边栏推荐
- 6个规则去净化你的代码
- Characteristics and Development Prospects of Korea's Cyber Security System
- POWER SOURCE ETA埃塔电源维修FHG24SX-U概述
- supervisor 命令操作大全「建议收藏」
- 单元测试
- STC8H development (15): GPIO drive Ci24R1 wireless module
- PMP daily practice | didn't lost a 8.9 (including agile + multi-select)
- Deceptive Dice(期望计算)
- APP automation test framework - UiAutomator2 introductory
- 浅谈Numpy中的shape、reshape函数的区别
猜你喜欢
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine reduce the immunogenicity of peptides
ACM MM 2022 | Cloud2Sketch: 长空云作画,AI笔生花
定投的基金
论文解读(DropEdge)《DropEdge: Towards Deep Graph Convolutional Networks on Node Classification》
SQL语句及索引的优化
Number of daffodils within a thousand
蓝牙模块的分类和对应的属性特点
SQLi-LABS Page-2 (Adv Injections)
抽象类 or 接口
knn到底咋回事?
随机推荐
抽象类 or 接口
简单问题窥见数学
Access control knowledge
Problems with compiling SIP with QGIS
AI识万物:从0搭建和部署手语识别系统
Beat the interviewer, the CURD system can also make technical content
ACM MM 2022 | Cloud2Sketch: Painting with clouds in the sky, AI brush strokes
微软word怎么转换成pdf文件?微软word转换为pdf格式的方法
威纶通触摸屏制作自定义弹出窗口的具体方法(3种)
技术分享 | 接口自动化测试如何处理 Header cookie
埃氏筛选法:统计素数个数
Jmeter 使用正则表达式提取器将返回值全部保存到一个文件中
【stack】【queue】【priority_queue】【deque】详解
Application of Acrel5000web Energy Consumption System in a College-Susie Week
Puyuan Jingdian turned losses into profits in the first half of the year, and high-end products continued to develop!Are you optimistic about "Huawei" in the instrument industry?
别叫我玩,我要考PMP:考PMP选择机构需要了解的那些事儿
Tensorflow中使用convert_to_tensor去指定数据的类型
筑牢安全防线 鹤壁经济技术开发区开展安全生产培训
RHEL7系统修复rm -rf /boot /etc/fstab
Number of daffodils within a thousand