当前位置:网站首页>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)
- 向下取整
边栏推荐
- LED闪烁 闪灯芯片IC 手电筒IC 闪灯控制IC 闪烁IC流水灯
- windos安装Mysql8.0,及解决重新登录异常问题 ERROR 1045 (28000)
- 字符串哈希(2014 SERC J题)
- Excel如何打出正负号?Excel打出正负号的方法
- How to deal with keys when Redis is large?
- 2021(ICPC)亚洲区域赛昆明站(CGHIJLM)
- C语言中的文件是什么?
- 筑牢安全防线 鹤壁经济技术开发区开展安全生产培训
- 企业数据打通有什么好处?不同行业怎么解决数据打通难题?
- Byte side: Can TCP and UDP use the same port?
猜你喜欢
buuctf (Adventure 2)
poj 3070 Fibonacci(简单矩阵连乘)
[Generic Programming] Full Detailed Explanation of Templates
Install Mysql8.0 on windos, and solve the problem of re-login exception ERROR 1045 (28000)
DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
LoRa无线技术在物联网应用市场的概况和发展
Byte side: Can TCP and UDP use the same port?
【泛型编程】模板全详解
DSPE-PEG-Silane,DSPE-PEG-SIL,磷脂-聚乙二醇-硅烷修饰二氧化硅颗粒用
Problems with compiling SIP with QGIS
随机推荐
痛击面试官 CURD系统也能做出技术含量
Byte side: Can TCP and UDP use the same port?
字节一面:TCP 和 UDP 可以使用同一个端口吗?
Deceptive Dice(期望计算)
在VMware上安装win虚拟机
Characteristics and Development Prospects of Korea's Cyber Security System
基于网络数据流的未知密码协议逆向分析
安科瑞支持以太网通讯、profibus通讯嵌入式电能表APM指导性技术要求-Susie 周
PMP每日一练 | 考试不迷路-8.9(包含敏捷+多选)
PMP每日一练 | 考试不迷路-8.8(包含敏捷+多选)
Application of Acrel5000web Energy Consumption System in a College-Susie Week
Word文档怎么输入无穷大符号∞
浅谈Numpy中的shape、reshape函数的区别
QGIS编译SIP的问题
[corctf 2022] section
数据集成API如何成为企业数字化转型的关键?
【高效工具】远程控制软件 ToDesk(收藏夹)
hdu 1503 Advanced Fruits(最长公共子序列的应用)
角度和弧度的相互换算
gmail+mtalk配合打免费网络电话。