当前位置:网站首页>np中的round函数,ceil函数与floor函数
np中的round函数,ceil函数与floor函数
2022-08-09 21:35: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()函数是四舍五入的含义.在误差理论中,当整数部分是偶数,小数部分是0.5时,向下取整;当整数部分是奇数,小数部分是0.5时,则向上取整.也就是说,当小数部分是0.5的时候,“去奇存偶”,这样得到的结果在统计学上更精确.numpy的round函数采用的正是这种方法.
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)
- 向下取整
边栏推荐
- 筑牢安全防线 鹤壁经济技术开发区开展安全生产培训
- 如何让您的公司内容满足 GDPR 合规性
- DSPE-PEG-Silane, DSPE-PEG-SIL, phospholipid-polyethylene glycol-silane modified silica particles
- URL Protocol web page to open the application
- C语言之实现倒置字符串的两种方法
- Number of daffodils within a thousand
- Byte side: Can TCP and UDP use the same port?
- Cholesterol-PEG-Thiol, CLS-PEG-SH, Cholesterol-PEG-Sulfhydryl for improved solubility
- Application of Acrel5000web Energy Consumption System in a College-Susie Week
- 抽象类 or 接口
猜你喜欢
Skywalking系列学习之Trace Profiling源码分析
【泛型编程】模板全详解
DSPE-PEG-Silane, DSPE-PEG-SIL, phospholipid-polyethylene glycol-silane modified silica particles
Word箭头上面怎么打字
Error when source install/setup.bash
蓝牙模块有哪些种类?BLE低功耗蓝牙模块有什么特点?
Don't use array.length-1 to get the last item of the array
小黑leetcode清爽雨天之旅,刚吃完宇飞牛肉面、麻辣烫和啤酒:112. 路径总和
消防安全培训|“蓝朋友”,开课了!
knn到底咋回事?
随机推荐
字节二面问的MySQL,差点没答好
Optimization of SQL Statements and Indexes
FET Mosfet Leiditech corresponds to Infineon Infineon
URL Protocol web page to open the application
mysql多表左链接查询
Overview of Security Analysis Technology for Smart Home Devices
Word文档怎么输入无穷大符号∞
定投的基金
Week 8 Deep learning for object detection
Visual studio 2022 debugging skills introduction
Don't tell me to play, I'm taking the PMP exam: what you need to know about choosing an institution for the PMP exam
痛击面试官 CURD系统也能做出技术含量
Unity_平滑移动
筑牢安全防线 鹤壁经济技术开发区开展安全生产培训
DSPE-PEG-PDP, DSPE-PEG-OPSS, phospholipid-polyethylene glycol-mercaptopyridine reduce the immunogenicity of peptides
【高效工具】远程控制软件 ToDesk(收藏夹)
题解:Edu Codeforces 109(div2)
Word怎么制作双面席卡?使用Word制作双面席卡方法
6 g underwater channel modeling were summarized based on optical communication
[Deep learning] pix2pix GAN theory and code implementation