>>> import numpy>>> a = numpy.array([[1, 0, 1], [0, 1, 1], [0, 1, 0]])>>> numpy.transpose(numpy.nonzero(a))array([[0, 0], [0, 2], [1, 1], [1, 2], [2, 1]])
↧
Answer by dlask for pythonic way to get index,column for value == 1
↧