Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
16 4 3 4

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-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
icon clock
10 |1500

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

@mbp
Thank you for your participation in the forum. Are any of the replies below satisfactory in resolving your query? If yes please click the 'Accept' text next to the reply that best answers your question. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.
Thanks,
-AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
18.2k 21 13 21

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 512.0 KiB each and 1.0 MiB total.

Upvotes
17.6k 82 39 63

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 512.0 KiB each and 1.0 MiB total.

Upvotes
16 4 3 4

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 512.0 KiB each and 1.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 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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