For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
46 5 5 5

Historical ESG Data - Unexpected output for a particular data point

Dear developer community,

I am pulling 10 year historical ESG Data on a number of data points. I use the same code for all the requests, and just replace the Eikon Code. However, when it comes to a specific datapoint, I get an unexpected output. See below:

Here is an example where I successfully output the historical data of another ESG datapoint:

ISIN_appended_df = []

for sublist in chunklist:

data7, err =ek.get_data(sublist, fields=["TR.EmissionReductionTargetPctage(SDate=0,EDate=-10,Period=FY0,Frq=FY).date","TR.EmissionReductionTargetPctage(SDate=0,EDate=-10,Period=FY0,Frq=FY)"],parameters=None, field_name=False, raw_output=False, debug=False)

ISIN_appended_df.append(data7)


ISIN_appended_df = pd.concat(ISIN_appended_df)

Result:

Here is the example where the same code fails to produce the expected outcome:

HSMS_df = []

for sublist in chunklist:

data7, err =ek.get_data(sublist, fields=["TR.HSMSCertifiedPctage(SDate=0,EDate=-5,Period=FY0,Frq=FY).date","TR.HSMSCertifiedPctage(SDate=0,EDate=-5,Period=FY0,Frq=FY)"],parameters=None, field_name=False, raw_output=False, debug=False)

HSMS_df.append(data7)


HSMS_df = pd.concat(HSMS_df)

Result:

As you can see, the column names do not have the expected titles, and there is no data outputted for any of the firms.

Thanks in advance

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apihistoricalesg
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvote
Accepted
8.2k 13 6 9

Hi @Erik77 - I can replicate the issue - the reason is that the second set of fields is not applicable (or we have no data for the company mentioned) - we can check this by looking at the Data Item Browser app (type DIB into Eikon search bar) - if we look for the field without an instrument we can see the field exists, but if we look for the field with one of the instruments you used say ISIN:DK0010244508 which is AP Moeller we see the field is not available:

So the way to figure out if this is an error or not is to look at the second err object to see if it returned anything - for a good and complete API call it will be empty:

data7, err =ek.get_data('DK0010244508', fields=["TR.EmissionReductionTargetPctage(SDate=0,EDate=-10,Period=FY0,Frq=FY).date","TR.EmissionReductionTargetPctage(SDate=0,EDate=-10,Period=FY0,Frq=FY)"],parameters=None, field_name=False, raw_output=False, debug=False) 

err

For an erroneous call it will be populated as it is for the second of your calls:

data7, err =ek.get_data('DK0010244508', fields=["TR.HSMSCertifiedPctage.date","TR.HSMSCertifiedPctage"],parameters={'SDate':'0','EDate':'-5','Period':'FY0','Frq':'FY'},raw_output=False) 

err

So a simple test like the following would take care of this:

if err:     
   #dont append and note error and ISIN     
   print('error') 
elif len(data7):         
   #append         
   print('good return')

I hope this can help.


1605888836941.png (129.4 KiB)
1605891045752.png (67.3 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you for your answer @jason.ramchandani. To be clear, you would add the suggested code inside the for loop correct? Where the append takes place? Please demonstrate inside the forloop if more helpful for explaining.

HSMS_df = []

for sublist in chunklist:

data7, err =ek.get_data(sublist, fields=["TR.HSMSCertifiedPctage(SDate=0,EDate=-5,Period=FY0,Frq=FY).date","TR.HSMSCertifiedPctage(SDate=0,EDate=-5,Period=FY0,Frq=FY)"],parameters=None, field_name=False, raw_output=False, debug=False)

HSMS_df.append(data7)


HSMS_df = pd.concat(HSMS_df)


Moreover, do we know why the field is not available for some companies? If I understand your reply correctly, under "regular" circumstances, fields are available for all companies in the universe, and if data is not available, the value returned is simply NaN. However, for TR.HSMSCertifiedPctage, do I understand correctly that the field e.g. the column itself, is not available for some companies all together? Why is this so?


Thanks in advance!