I have a data frame with a column containing arrays (all 1x9 arrays). For all rows in that column, I wish to find the ones where the third element is 1 and pick out the values from another column in the corresponding row. For example, I wish to pick out the 'cal_nCa' value (116) where the second element in info_trig is 0
info_trig cal_nCa
0 [0, 1, 0, 0, 0, 0, 0, 0, 0] 128
1 [0, 1, 0, 0, 0, 0, 0, 0, 0] 79
2 [0, 0, 0, 1, 0, 0, 0, 1, 0] 116
3 [0, 1, 0, 0, 0, 0, 0, 0, 0] 82
I tried something in line of df["A"][(df["B"] > 50)]
, based on Selecting with complex criteria from pandas.DataFrame.
When selecting the desired rows:
data["info_trig"][:][3]
I only succeed selecting a specific row and the third element in that row. But unable to select all the third element in every row. A loop could work but I hope there is a cleaner way out.