I know a bit about pandas.Period and pandas.PeriodIndex. But I am not able to make them fit to my use case.
I have a list of quarter strings in format YYYYQ:
df = pandas.DataFrame({'quarter': ['20214', '20222']})
How can I create a PeriodIndex or Period (each element) of it?
I am not able to do this
pandas.PeriodIndex(df.quarter, freq='Q')
because my strings doesn't contain a q or Q at the right position. I could do some string manipulation in a first step to insert a q at the right position. But I wonder if PeriodIndex gives me the ability to specify a format string like YYYYQ.