当前位置:网站首页>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)
- 向下取整
边栏推荐
- 普源精电上半年扭亏为盈,高端产品持续发力!你看好仪器界“华为”吗?
- DSPE-PEG-Azide, DSPE-PEG-N3, phospholipid-polyethylene glycol-azide can react directly with DBCO
- Interviewer: How to deal with Redis big key?
- 一千以内的水仙花数
- 【stack】【queue】【priority_queue】【deque】详解
- 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?
- hdu 1503 Advanced Fruits(最长公共子序列的应用)
- Install Mysql8.0 on windos, and solve the problem of re-login exception ERROR 1045 (28000)
- supervisor 命令操作大全「建议收藏」
- MySQL慢查询的多个原因
猜你喜欢
C语言之实现倒置字符串的两种方法
10个 Istio 流量管理 最常用的例子,你知道几个?
微软word怎么转换成pdf文件?微软word转换为pdf格式的方法
poj 3070 Fibonacci(简单矩阵连乘)
字节一面:TCP 和 UDP 可以使用同一个端口吗?
企业数据打通有什么好处?不同行业怎么解决数据打通难题?
Ankerui supports Ethernet communication, profibus communication embedded energy meter APM guiding technical requirements-Susie Week
Error when source install/setup.bash
Skywalking系列学习之Trace Profiling源码分析
Word第一页空白页怎么删除?删除Word第一页空白页方法教程
随机推荐
Word怎么制作一张标准的答题卡?
Number of daffodils within a thousand
Definition and Basic Operations of Sequence Tables
XXE-XML外部实体注入-知识点
Access Characteristics of Constructor under Inheritance Relationship
字节二面问的MySQL,差点没答好
蓝牙模块有哪些种类?BLE低功耗蓝牙模块有什么特点?
线段相交的应用
Optimization of SQL Statements and Indexes
DSPE-PEG-Silane,DSPE-PEG-SIL,磷脂-聚乙二醇-硅烷修饰二氧化硅颗粒用
Don't use array.length-1 to get the last item of the array
基于网络数据流的未知密码协议逆向分析
windos安装Mysql8.0,及解决重新登录异常问题 ERROR 1045 (28000)
浅谈Numpy中的shape、reshape函数的区别
What to do if Windows 11 can't find Internet Explorer
C语言预处理命令是什么?
LoRa无线技术在物联网应用市场的概况和发展
Simulation of Water Temperature Control System Based on Fuzzy PID Controller
PMP每日一练 | 考试不迷路-8.8(包含敏捷+多选)
POWER SOURCE ETA埃塔电源维修FHG24SX-U概述