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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
16 1 1 3

Why does Eikon.get_data() return a tuple

Hi,

when I run this code line it returns a tuple (of tuples?) where I would have expected a data frame.

Is this to be expected?

const_data=ek.get_data(members,['TR.MarketCapLocalCurn','TR.GicsSector'])

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpython
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.

Upvotes
Accepted
18k 21 12 20

Hi @mbp

Either single or multiple item, the return type is tuple.

If you want dataframe, you can follow the code nick suggested.


ahs.png (17.6 KiB)
ahs2.png (19.7 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.

Upvotes
9.7k 49 38 60

Hi @mbp,

The get_data() returns a tuple to capture the data and a list of error details, if any:

If you are strictly interest in the data, you simply need to construct your return value as:

thanks.


ahs.png (6.5 KiB)
ahs.png (7.9 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.

Upvotes
16 1 1 3

Hi again.

When there is one item in members it returns a dataframe, but when there are more than one it returns a tuple.

I don't think you've answered the question.

rgds

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.

Upvotes
81 0 2 3

Or just add [0] in the end


screenshot-1.jpg (37.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.

Click below to post an Idea Post Idea