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
Best Answer
-
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)
errFor 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)
errSo 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.
0
Answers
-
Thank you for your answer @jason.ramchandani01. 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!
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 249 ETA
- 554 WebSocket API
- 37 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 643 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 192 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛