当前位置:网站首页>argmax函数笔记-全是细节
argmax函数笔记-全是细节
2022-06-23 10:20:00 【思考实践】
Code-Demo:
a = np.array([[6,0],
[2,9]])
print(np.argmax(a))
# 3 (把[[6,0],[2,9]]看成[6,0,2,9]。从0索引,第3个索引的元素最大)
print(np.argmax(a,axis=0))
# [0 1]
# 沿列看,第一列第0个位置(元素'6')最大,
# 沿列看,第二列第1个位置(元素'9')最大。依旧是从0开始索引)
print(np.argmax(a,axis=1))
# [0 1]
# 沿行看,第一行第0个位置(元素'6')最大,
# 沿行看,第二行第1个位置(元素'9')最大。依旧是从0开始索引)
输出:
3
[0 1]#列
[0 1]#行
参考资料
NumPy学习笔记(四)—— argmax()函数_ac不知深的博客-CSDN博客_argmax
边栏推荐
- Unity technical manual - shape sub module - Sprite, spriterenderer and velocity over lifetime
- 文件IO(1)
- 技术创造价值,手把手教你薅羊毛篇
- Unity技术手册 - 形状(Shape)子模块 - Sprite、SpriteRenderer及生命周期内速度(Velocity over Lifetime)
- pycharm安装教程,超详细
- Experience of using thread pool in project
- 图片存储--引用
- Unity technical manual - limit velocity over lifetime sub module and inherit velocity sub module
- Pycharm installation tutorial, super detailed
- Mysql 的Innodb引擎和Myisam数据结构和区别
猜你喜欢
随机推荐
Step by step introduction to sqlsugar based development framework (9) -- Realizing field permission control with WinForm control
卧槽,最惊艳的论文神器!
SQL create a new field based on the comparison date
Verification code redis practice summary
【第23天】给定一个长度为 n 的数组,将元素 X 插入数组指定的位置 | 数组插入操作4
Solve the problem of invalid audio autoplay
SQL writing problem to calculate the ring ratio of the current month and the previous month
汇编语言中断及外部设备操作篇--06
Description of directory files of TLBB series of Tianlong Babu - netbill server [ultra detailed]
NOI OJ 1.3 14:大象喝水 C语言
NOI OJ 1.4 03:奇偶数判断 C语言
JVM easy start-02
Is IPv6 faster than IPv4?
Golang quick start (3)
Build a QQ robot to wake up your girlfriend
炫酷相册代码,祝对象生日快乐!
Install the typescript environment and enable vscode to automatically monitor the compiled TS file as a JS file
NOI OJ 1.4 01:判断数正负 C语言
MySQL-02.工作中对索引的理解
验证码redis实践总结








