Assuming I have the following Pandas DataFrame:
U A B
0 2000 10 20
1 3000 40 0
2 2100 20 30
3 2500 0 30
4 2600 30 40
How can I get the index of first row that both A and B have non-zero value and (A+B)/2 is larger than 15
?
In this example, I would like to get 2
since it is the first row that have non-zero A and B column and avg value of 25
which is more than 15
Note that this DataFrame is huge, I am looking for the fastest way to the index value.