| BrkPressState | VehSpdGS |
|---|---|
| 1 | 2 |
| 1 | 3 |
| 1 | 2 |
| 1 | 4 |
| 0 | 12 |
| 0 | 13 |
| 0 | 11 |
| 1 | 3 |
| 0 | 15 |
| 0 | 14 |
| 0 | 15 |
| 1 | 12 |
| 1 | 13 |
| 0 | 14 |
For the above table i am trying to populate the next row value in previous last event, Like the below table
I tried with Shift - 1 but its populating only for the current row , Sample code which i tried.
d['result']=d.loc[d['BrkPressState'] != d['BrkPressState'].shift(-1), 'VehSpdGS']
Expected output:
