np.where和np.bincount详解
来源:互联网 发布:linux 命令下载libgcj 编辑:程序博客网 时间:2024/05/29 09:41
原文地址:https://stackoverflow.com/questions/23359886/selecting-rows-in-numpy-ndarray-based-on-the-value-of-two-columns?rq=1
简单用法
a = np.array(xrange(5*3))
a.shape =(5,3)
对这样一个数组进行操作:
array([[0,1,2],[3,4,5],[6,7,8],[9,10,11],[12,13,14]])
寻找以9开头的某一行:
a[np.where(a[:,0]==9)] —->#array([[ 9, 10, 11]])寻找l列中某一值等于4的某一行:
a[np.where(a[:,1]==4)] —->array([[3, 4, 5]])寻找某一行:第一位值为0,第二位值为1:
a[np.where((a[:,0]==0)*(a[:,1]==1))]#array([[0,1, 2]])
np.bincount详解
原文链接:
http://blog.csdn.net/xlinsist/article/details/51346523
阅读全文
0 0
- np.where和np.bincount详解
- find 和 np.where
- np.where
- numpy 之 np.where
- np.where函数
- python np.where()
- numpy: np.where
- python np.where
- NP
- np
- NP
- NP
- NP
- NP
- NP
- NP-Hard 和 NP-Complete
- np.tile 和np.newaxis
- np.ravel()和np.flatten()
- Hadoop自定义类型处理手机上网日志(笔记5)
- java的四大作用域及线程的生命周期
- CentOS 6.5 + Nginx 1.8.0 + PHP 5.6(with PHP-FPM)
- 回到顶部的几种写法
- BC1.2
- np.where和np.bincount详解
- redis zset ( [
- jq事件冒泡
- Oracle case when else
- 一种肯定能提高开发者编程能力的方法
- hdu 1568求斐波那契数的前4位 && hdu3117矩阵快速幂
- 深度神经网络(DNN)是否模拟了人类大脑皮层结构?
- RAS 工具类
- Cyrillic script