[英]How to return the row index of each element from a 2D array?
I have a 8x10 2D array, A. I need another 2D array that stores only the row index of each element of A. How do I go about doing so?我有一个 8x10 二维数组 A。我需要另一个只存储 A 的每个元素的行索引的二维数组。我 go 如何这样做? Appreciate your help!感谢你的帮助!
I think I got it!我想我明白了!
C = np.array(np.where(A))[0].reshape(10, 8)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.