I have 238 dataframes that look like this:
Index | before | after |
---|---|---|
a,1 | 10 | 10 |
b,2 | 10 | 100 |
c,3 | 100 | 100 |
d,4 | 1000 | 100 |
I would like to have a for loop which would drop all of the rows where before and after values are the same (leave only those rows where they are different). Example
Index | before | after |
---|---|---|
b,2 | 10 | 100 |
d,4 | 1000 | 100 |
Right now, I just have 238 of these: onlydiffs_dfi = dfi[dfi['before'] != dfi['after']]
Which is obviously not great, and can be accomplished with a for loop but I but figure out how to write it. Please help!