Given an array of objects:
a = numpy.array([[True,False],[True,True],[True,False,True]])
Expected output:
[[0],[0,1],[0,2]]
Is there a way to get this output using numpy.where()(may be with numpy.vstack() or numpy.hstack()) or some other numpy functionality that I am not aware of?
So far I've tried:
c = [numpy.hstack(numpy.where(a[i])) for i in range(len(a))]
This solves my purpose but I want to vectorize it using numpy functionalities!
PS : Don't want any loops!