pandas get row if difference previous

Solutions on MaxInterview for pandas get row if difference previous by the best coders in the world

showing results for - "pandas get row if difference previous"
Camil
03 Oct 2018
1>>> df = pd.DataFrame({'a': [1, 2, 3],
2...                    'b': [1, 1, 2],
3...                    'c': [1, 4, 9]})
4
5>>> df
6   a  b   c
70  1  1   1
81  2  1   4
92  3  2   9
10
11>>> df.diff()
12
13     a    b     c
140  NaN  NaN   NaN
151  1.0  0.0   3.0
162  1.0  1.0   5.0
17