It may be simple, but for some reason I can't think of a good way to solve it.
So, let's say this is my DataFrame:
a b
0 99 3
1 99 56
2 1 7
3 1 80
4 1 55
5 2 601
6 2 -4
7 1 33
8 1 22
I would like to create a new column, c, where the values will be the last value of b in the previous value of a, so the output should be:
a b c
0 99 3 nan
1 99 56 nan
2 1 7 56
3 1 80 56
4 1 55 56
5 2 601 55
6 2 -4 55
7 1 33 -4
8 1 22 -4
Any help will be appreciated!
avalues always increasing?