关于numpy.maximum函数的测试
2024-10-14 16:18:28
atr.py
import numpy as np
a = np.arange(9)
print("a:",a)
print(a[0:3])
print(a[3:6])
print(a[6:9])
print("testj:" ,np.maximum(a[0:3], a[6:9],a[3:6]))
print(a[0:3])
print(a[3:6])
print(a[6:9]) -----------------------
输入结果:
a: [0 1 2 3 4 5 6 7 8]
[0 1 2]
[3 4 5]
[6 7 8]
testj: [6 7 8]
[0 1 2]
[6 7 8]
[6 7 8]
-------------------------------------
atr.py
import numpy as np
a = np.arange(9)
print("a:",a)
print(a[0:3])
print(a[3:6])
print(a[6:9])
print("testj:" ,np.maximum(a[0:3],a[3:6],a[6:9]))
print(a[0:3])
print(a[3:6])
print(a[6:9])
-----------------------
输入结果:
a: [0 1 2 3 4 5 6 7 8]
[0 1 2]
[3 4 5]
[6 7 8]
testj: [3 4 5]
[0 1 2]
[3 4 5]
[3 4 5]
最后print(“a:”a)
结果a: [0 1 2 3 4 5 3 4 5]
最新文章
- Python中利用LSTM模型进行时间序列预测分析
- [MySql]explain用法及实践
- C++ Primer :第十章 :泛型算法之再探迭代器以及其他算法
- Python中用datetime包进行对时间的一些操作
- Cgroups概述
- GCC编译器入门
- Java基础知识强化70:正则表达式之引入案例(QQ号码校验)
- CentOS 7安装SVN以及高版本SVN
- Linux下配置APACHE支持PHP环境
- cocos creator主程入门教程(八)—— 代码结构
- php常用数组array函数实例总结【赋值,拆分,合并,计算,添加,删除,查询,判断,排序】
- 找出数组中最大值and索引
- ";Linux内核分析";第六周实验报告
- How to set the bash display to not show the vim text after exit?
- 运行程序,解读this指向---case4
- DP练习 巡逻
- php excel 读取日期问题
- Oracle rman 脚本
- swift算法手记-10
- ogre3D学习基础2 -- 顶点程序与片断程序