pandas column with difference between previous value code example
Example: pandas get row if difference previous
>>> df = pd.DataFrame({'a': [1, 2, 3],
... 'b': [1, 1, 2],
... 'c': [1, 4, 9]})
>>> df
a b c
0 1 1 1
1 2 1 4
2 3 2 9
>>> df.diff()
a b c
0 NaN NaN NaN
1 1.0 0.0 3.0
2 1.0 1.0 5.0