Hi community,
I am working with institutional ownership data and I extracting quarterly historical investor data. I want to convert my dates for each company to quarterly format as is shown in the attached picture below.
My current data looks like this:
But I want it in the format as shown
I have had a look at @Alan Tam123 post https://community.developers.refinitiv.com/questions/60189/date-format-and-column-headings.html but the code seems to be different from how I am doing it.
Any help would be great! @Jirapongse look forward to your expert help.
My code is attached below:
df,e = ek.get_data(instruments=['AAPL.O','AAL.L'], fields=[
'TR.CommonName',
'TR.InvestorFullName("TheInvestorType":"113,108,107")',
'TR.SharesHeld.calcdate',
'TR.SharesHeld',
'TR.PctOfSharesOutHeld',
'SUM(TR.PctOfSharesOutHeld)',
'TR.InvestorType',
'TR.InvestorTypeId'],parameters={'SDate':'0','EDate':'-4', 'Period':'FQ0','Frq':'FQ'})
df
#EDate is the number of quaters
df1= df
df1['id']=df1.groupby(['Instrument']).ngroup()
df1.set_index(['id','Calc Date'])