I have a unique dataframe, df:
name val_1 val_2 val_3 val_4
AAA 1 2 3 11
BBB 2 3 5 9
CCC 6 4 15 10
I need to keep only that name where any right-side val column increases by 10 from any of the previous val columns, otherwise drop them.
I know that diff() and ge() would be helpful here, but not sure how they would work if the difference isn't about between next-to-next column.
Desired output:
name
AAA #val_4 increases by 10 from val_1
CCC #val_3 increases by 11 from val_2
What would be the smartest way of doing it? Any suggestions would be appreciated. Thanks!