I have this dataset
In [4]: df = pd.DataFrame({'A':[1, 2, 3, 4, 5]})
In [5]: df
Out[5]:
A
0 1
1 2
2 3
3 4
4 5
I want to add a new column in dataset based em last value of item, like this
| A | New Column |
|---|---|
| 1 | |
| 2 | 1 |
| 3 | 2 |
| 4 | 3 |
| 5 | 4 |
I tryed to use apply with iloc, but it doesn't worked
Can you help
Thank you