numpy之flatnonzero函数
2024-08-30 09:34:19
Return indices that are non-zero in the flattened version of a.
This is equivalent to a.ravel().nonzero()[0].
Parameters: |
a : ndarray
|
---|---|
Returns: |
res : ndarray
|
See also
Examples
>>> x = np.arange(-2, 3)
>>> x
array([-2, -1, 0, 1, 2])
>>> np.flatnonzero(x)
array([0, 1, 3, 4])
Use the indices of the non-zero elements as an index array to extract these elements:
>>> x.ravel()[np.flatnonzero(x)]
array([-2, -1, 1, 2])
最新文章
- linux下libevent安装
- [CareerCup] 6.6 Toggle Lockers 切换锁的状态
- Redis 简单命令
- .NET MEF入门级例子
- MPlayer-2016-bin-noConsole
- Spring Assert(方法入参检测工具类-断言)
- Java for LeetCode 142 Linked List Cycle II
- 机器学习 —— 概率图模型(学习:CRF与MRF)
- Thread学习
- 连载:面向对象葵花宝典:思想、技巧与实践(32) - LSP原则
- HDOJ 1004题 Let the Balloon Rise strcmp()函数
- 2014-08-26 解决HttpContext.Current.Session在ashx文件中出现“未将对象引用设置到对象的实例”的问题
- android如何用adb shell启动应用程序
- 克隆 CentOS 后系统启动问题解析
- Python操作文件和目录
- Java-TreeSet的用法-入门
- Hibernate学习---用Session实现CURD
- DxPackNet 5.视频高质量的压缩和传输
- SVN简单的使用
- jquery 判断 元素是否具有某个class
热门文章
- 一个普通Java程序包含哪些线程??
- debian使用apt安装时出现“更换介质,插入驱动器";/media/chrom/";再按回车键”的提示,无法从网络安装,解决?
- top 进程管理
- STL使用迭代器逆向删除
- PMP项目管理学习笔记引言(1)——为啥要取得认证?
- 项目经验——jboss 配置数据库连接池
- Gym 100883J	palprime(二分判断点在凸包里)
- Linux命令基础操作--vim 归档 压缩 分区 格式化 挂载 Innode
- react native在xcode真机调试ios
- 使用Spring AOP实现业务依赖解耦