I'm using Python Pandas to prep my data into series as inputs for timeseries modeling.
I have a dataframe with dates called DATE. I tell Pandas its format (see below). Since we use fiscal calendar, with end of the fiscal year being March, I use to_period("Q-MAR"). However, I also need to specify that we use 445 calendar. For example, 12/30/2012 is supposed to be FY2013 Q4, and 3/29/2015 is FY2016 Q1.
The below, will translate 12/30/2012 to 2013Q3, and 3/29/2015 to 2015Q4:
df['date'] = pd.to_datetime(df['DATE'], format="%m/%d/%Y")
df['fiscalyr'] = df['date'].dt.to_period("Q-MAR")
I've been messing around with QuarterFY5253 offset object in Pandas. But I'm still lost.
I hope someone has encountered similar problem and can guide me! Thank you.