I'm reading in a .csv file that looks something like this:
DateTime Failures
0 2020-05-27 00:10:49 0
1 2020-05-27 00:10:49 0
2 2020-05-27 00:21:55 0
3 2020-05-27 00:22:56 1
4 2020-05-27 00:22:59 0
What I'm trying to do is grab any row that has a failure along with the previous row.
I can get the rows with failures by using
log_file = pd.read_csv(self.input.text())
failures = log_file[log_file['Failures'] != 0]
but am unsure how to also grab the row before each failure.
I'm very new to Python and feel like there's probably an easy solution for my problem, I'm just not sure how to get it.