If you want to get the difference between rows within a column, use DataFrame.diff()
.
This will leave the first index null. You can shift the rows up to match the first difference with the first index using DataFrame.shift(-1)
.
Find an example above.
#datascience #python