I have a log file in following format:
Item | Month_end_date | old_price | new_price | row |
---|---|---|---|---|
A | 2022-03-31 | 25 | 30 | 1 |
A | 2022-06-30 | 30 | 40 | 2 |
A | 2022-08-31 | 40 | 45 | 3 |
B | 2022-04-30 | 80 | 70 | 4 |
Here, its assumed that the price of the item A from the start of the year was 25 using 1st row of the above table. I want to get monthly prices using this table. The ideal output looks like the table below:
Item | Month_end_date | price |
---|---|---|
A | 2022-01-31 | 25 |
A | 2022-02-28 | 25 |
A | 2022-03-31 | 30 |
A | 2022-04-30 | 30 |
A | 2022-05-31 | 30 |
A | 2022-06-30 | 40 |
A | 2022-07-31 | 40 |
A | 2022-08-31 | 45 |
A | 2022-09-30 | 45 |
A | 2022-10-31 | 45 |
A | 2022-11-30 | 45 |
A | 2022-12-31 | 45 |
B | 2022-01-31 | 80 |
B | 2022-02-28 | 80 |
B | 2022-03-31 | 80 |
B | 2022-04-30 | 70 |
B | 2022-05-31 | 70 |
B | 2022-06-30 | 70 |
B | 2022-07-31 | 70 |
B | 2022-08-31 | 70 |
B | 2022-09-30 | 70 |
B | 2022-10-31 | 70 |
B | 2022-11-30 | 70 |
B | 2022-12-31 | 70 |