Home > other >  Creating n quarter ahead date
Creating n quarter ahead date

Time:09-28

I have following date object

import datetime as datetime
import pandas as pd
Date = pd.Timestamp(datetime.datetime(2000, 1, 31, 0, 0))

Now I want to create another date which is 5 quarters ahead from Date.

Is there any direct method to achieve this?

CodePudding user response:

(pd.Period(Date, freq='Q') 5).to_timestamp()
Timestamp('2001-04-01 00:00:00')

to make it end of month

(pd.Period(Date, freq='Q') 5).to_timestamp(freq='M')
Timestamp('2001-04-30 00:00:00')
  • Related