Answers for "pandas find difference between two rows"

0

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
Posted by: Guest on December-03-2020

Code answers related to "pandas find difference between two rows"

Python Answers by Framework

Browse Popular Code Answers by Language