I would like to delete the last rows based on a condition. For example I have the following columns :
voltage | Current
0 10 | 0.8
1 12 | 0.7
3 14 | 0.6
4 0 | -0.0001
5 10 | 0.8
6 12 | 0.7
7 14 | 0.6
8 0 | -0.0001
9 0 | -0.0001
In this case, I want to remove the 2 last rows (when voltage = 0) without removing the 4th row.
I was thinking about a while loop that starts from the end of the dataframe and delete all rows with voltage = 0. It will stop when voltage is different from 0.
Any idea ?