假设我有一个numpy数组的形式:
arr=numpy.array([[1,1,0],[1,1,0],[0,0,1],[0,0,0]])
我想找到值为非零的第一个索引(对于每一列)的索引.
所以在这个例子中,我希望返回以下内容:
[0,0,2]
我该怎么做?
python numpy
numpy ×1
python ×1