I have a dataframe with many variables, but I want to focus on two of them:
Time | Value
Start 200
1 50
2 50
4 50
8 50
12 80
24 80
Start 300
1 50
2 50
4 50
8 50
12 60
24 70
Start 250
These columns represent the value for a given time.
I want to obtain another column that represents the difference in value between a given time and the start.
To make it clear, I would like something like:
Time | Value | Change
Start 200 200
1 50 150
2 50 150
4 50 150
8 50 150
12 80 120
24 80 120
Start 300 300
1 50 250
2 50 250
4 50 250
8 50 250
12 60 240
24 70 230
Start 250 250
So it’s a simple mathematical operation.
However, the tricky part is to compute always against the last start
value, and I haven’t find a way of doing this so far.
Any help is highly appreciated.