Hi there,
I am trying to pull revenue segment data of companies based on a list of RIC codes. And get the keyerror: "headers".
My code looks as follows:
#Making list of instrument codes
riclist_HIP = data_2.Instrument.to_list()
#Calling the data
data_3,err = ek.get_data(riclist_HIP, ['TR.BGS.GeoTotalRevenue.segmentName', 'TR.BGS.GeoTotalRevenue','TR.CompanyName'])
data_3
Error:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-17-b29cf30df8f5> in <module>
1 #Making TR API Call
----> 2 data_3,err = ek.get_data(riclist_HIP, ['TR.BGS.GeoTotalRevenue.segmentName', 'TR.BGS.GeoTotalRevenue','TR.CompanyName'])
3 data_3
~/opt/anaconda3/lib/python3.7/site-packages/eikon/data_grid.py in get_data(instruments, fields, parameters, field_name, raw_output, debug)
195 return result
196
--> 197 return get_data_frame(result, field_name)
198
199
~/opt/anaconda3/lib/python3.7/site-packages/eikon/data_grid.py in get_data_frame(data_dict, field_name)
244 headers = [header.get('field', header.get('displayName')) for header in data_dict['headers'][0]]
245 else:
--> 246 headers = [header['displayName'] for header in data_dict['headers'][0]]
247 data = pd.np.array([[get_data_value(value) for value in row] for row in data_dict['data']])
248 if len(data):
KeyError: 'headers'
Could you please assist?
I saw other people have posted around this error but was unclear on how to adapt the solutions proposed to my case.
Many thanks in advance