np.where on a numpy MxN matrix but return M rows with indices where condition exists
I am trying to use np.where on a MxN numpy matrix, where I want to return the same number of M rows but the indices in each row where the element exists. Is this possible to do so? For example: