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.
1
Answers
-
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!
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 162 App Studio
- 4 Block Chain
- 5 Bot Platform
- 17 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 370 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛