Pandas difference between rows in a column

df.diff()

Here is what the above code is Doing:
1. We’re using the .diff() method to calculate the difference between the current row and the previous row.
2. We’re using the .shift() method to shift the index of the current row back by 1.
3. We’re using the .dropna() method to drop the NaN values that are created by the shift.