I currently have a MxN dataframe which contains a solution to an optimization problem. "Active" i,j for i in {M} and j in {N} pairs are represented by 1 and "inactive" pairs by 0. I need to determine i,j values for all active cells, hopefully avoiding a for loop over index or columns.
This would be an example:
In [73]: sol_dfOut[73]: 1 2 3 4 51 0 0 1 0 02 1 0 0 0 03 0 1 0 0 04 0 0 0 0 0
In this case, what I would require is a list of pairs (tuples would do):
[(1,3), (2,1), (3,2)]
Is there a way?
Thanks!
A.
EDIT: explanation was unclearEDIT2: my explanation was still unclear