Sure I could write this myself, but before I go reinventing the wheel is there a function that already does this?
For those, who are looking for financial year quarter data, using pandas,
import datetime import pandas as pd today_date = datetime.date.today() quarter = pd.PeriodIndex(today_date, freq='Q-MAR').strftime('Q%q')
reference: pandas period index