I'm trying to create a new column with the calendar year's quarter end date (e.g. if today is 4 August, this quarter's end date would be 30 September).
My DataFrame has a set of dates in a column called df['dates']. Sample below:
03/08/2017
26/02/2015
31/12/2012
16/04/2014
13/04/2016
This is the code I am using, which is not working:
df['q_date'] = pd.datetime(pd.tseries.offsets.QuarterEnd(startingMonth=(pd.to_datetime(df['date']).dt.month)))
I have also tried looping through but have been unsuccessful.
Any ideas are most appreciated. Thanks.