unexpected IndexError
I am getting a really strange error when executing following lines
IndexError: index 2 is out of bounds for axis 0 with size 2
This is unexpected to me because it only happens to this 2 RICs. Anyone has any clue on why these 2 RICs are so special?
rics = ['005110.KS', '005160.KQ']
df2 = ek.get_timeseries(rics=rics, start_date='2021-04-06', end_date='2021-04-06', corax='unadjusted')
df2.stack(level=-2)
Best Answer
-
@Max.Zhu Yes it took me a while! So the issue here seems to be something with the stack routine that doesn't like integer values. So if you look at df2.info() for the Korean stocks that are causing issues - they are of int64 type:
Now if I change the dataframe Dtype from int64 to float then try the stack:
df3 = df2.astype(float).copy()
df3.stack(level=-2)It all works fine, So I believe this is some DType issue with Pandas' stack routine. I will also speak to the dev team to check if the type conversions at our end are all correct.
I also checked with some other RICs ['VOD.L','BARC.L'] and they returned a mixture of floats and ints and it all worked correctly. I hope this can help.
0
Answers
-
Hi @Max.Zhu,
This issue isn't linked to rics.
When you request more than 1 ric, the result is not a pure multi-level indexed Dataframe but a concatenation of multi-level indexed Dataframe, that's why you can't stack it.
If you iterate on rics, you can stack each sub-Dataframe:
for ric in rics:
print(ric)
df = df2[ric]
print(df)
print("________________")
df = df.stack()
print(df)Result:
005110.KS
HIGH LOW OPEN CLOSE VOLUME
Date
2021-04-06 1275 1240 1255 1255 587997
________________
Date
2021-04-06 HIGH 1275
LOW 1240
OPEN 1255
CLOSE 1255
VOLUME 587997
dtype: Int64
005160.KQ
HIGH LOW OPEN CLOSE VOLUME
Date
2021-04-06 3670 3590 3670 3650 162384
________________
Date
2021-04-06 HIGH 3670
LOW 3590
OPEN 3670
CLOSE 3650
VOLUME 162384
dtype: Int64Thank you for your feedback, we'll plan to fix it.
0 -
That's in fact exactly what I did offline to workaround the issue...
Thanks for confirming this! It will be good if Eikon API can do the conversion automatically.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 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
- 367 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
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛