Hello! While trying to search for companies in a specific country under a specific TRBC Activity name (industry or sector basically) with the SCREEN function, I get a KeyError: 'headers' from the screen data request:
Belgium = pd.DataFrame()
for item in TRBC_Sectors:
country = '"BE"'
activity = item
exp = 'SCREEN(U(IN(Equity(active,public,private,primary))), IN(TR.RegCountryCode,{}), IN(TR.TRBCActivityCode,{}), CURN=USD)'.format(country,activity)
fields = ["TR.CommonName","TR.TRBCActivity"]
output, err = ek.get_data(exp, fields)
Belgium = Belgium.append(output)
while TRBC_Sectors is a list with strings for each of the TRBC Activity sectors: e.g.
['5010101010', '5010101011', '5010101012', '5010201010', '5010202010', '5010202011', '5010202012', '5010202013', '5010202014', '5010202015', '5010203010', '5010203011', '5010203012', '5010203013', '5010301010', '5010301011', '5010301012', '5010301013', '5010301014']
Error message:
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-23-8361b97df6fa> in <module>
5 exp = 'SCREEN(U(IN(Equity(active,public,private,primary))), IN(TR.RegCountryCode,{}), IN(TR.TRBCActivityCode,{}), CURN=USD)'.format(country,activity)
6 fields = ["TR.CommonName","TR.TRBCActivity"]
----> 7 output, err = ek.get_data(exp, fields)
8 Belgium = Belgium.append(output)
~\AppData\Local\Continuum\anaconda3\lib\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
~\AppData\Local\Continuum\anaconda3\lib\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'