Currently, I can generate quarterly, monthly and yearly index by changing frequency in following code.
df['period_index'] = pd.PeriodIndex(df.Date, freq='Q')
Is there a way to tweak freq
and get semi annual index?
There's a bit of a work-around if you use date_range
first:
pd.PeriodIndex(pd.date_range(df.Date.min(), df.Date.max(), freq="6M"))