I have a dataframe with date, previous_day, and price.
DATE | prev_day | price
01-01-2018 | 1 | 44
02-01-2018 | 1 | 45
02-01-2018 | 2 | 41
03-01-2018 | 1 | 54
03-01-2018 | 2 | 49
03-01-2018 | 3 | 46
I would like to create the next day and prior day using the next step:
DATE | prev_day | price | next_day | prior_day
01-01-2018 | 1 | 44 | |
02-01-2018 | 1 | 45 | |
02-01-2018 | 2 | 41 | |
03-01-2018 | 1 | 54 | |
03-01-2018 | 2 | 49 | |
03-01-2018 | 3 | 46 | |
Where the logic consists of each next_day equals the price with DATE + 1 day and prev_day + 1 day, and prior_day equals the price with DATE - 1 day and prev_day - 1 day.