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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 0

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)
eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythontimeseries
icon clock
10 |1500

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

1 Answer

Upvotes
Accepted
6.7k 8 6 7

@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.



1617782027201.png (122.3 KiB)
1617782241014.png (31.5 KiB)
icon clock
10 |1500

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

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.

Click below to post an Idea Post Idea