I am pretty new to Datetime and pandas. I want to add new date row based on the given value. If the input is 2 then the program should two dates from the last row value. I could able to get the dates but I Am not able to insert them into the data frame. Here the Date is an index. Is there any way to do it?
My input:
df=
column1
2020-12-22 1
2020-12-23 2
2020-12-24 3
start = df.index.max()
numdays =4
date_list = [start - datetime.timedelta(days=x) for x in range(numdays)]
date_list
The output is as follows:
[Timestamp('2020-12-24 00:00:00'),
Timestamp('2020-12-25 00:00:00'),
Timestamp('2020-12-26 00:00:00'),
Timestamp('2020-12-27 00:00:00')]
Expected Output:
column1
2020-12-22 1
2020-12-23 2
2020-12-24 3
2020-12-25 Naan
2020-12-26 Naan
2020-12-27 Naan
