2023年8月31日
numpy.nonzero
https://numpy.org/doc/stable/reference/generated/numpy.nonzero.html#numpy.nonzero
numpy.nonzero(a)[source]
Return the indices of the elements that are non-zero.
Returns a tuple of arrays, one for each dimension of a, containing the indices of the non-zero elements in that dimension. The values in a are always tested and returned in row-major, C-style order.
To group the indices by element, rathe…