5

I have multiple df, and they are indexed with timestamps for consecutive months. For example:

1996-01-01 01:00:00
1996-02-01 01:00:00
1996-03-01 01:00:00
1996-04-01 01:00:00
1996-05-01 01:00:00
1996-06-01 01:00:00

I'm trying to create a function where I can add an arbitrary number of rows onto the df, continuing on from whatever the last month happens to be. I tried to solve this by using:

df.iloc[-1].name + pd.Timedelta(1, unit='M')

in a for loop, but this only seems to add 30 days, instead of changing the month value +1. Is there a more reliable way to fetch a pd.Timestamp and add 1 month?

Thank you

IanT
  • 79
  • 1
  • 5

0 Answers0