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
3 1 0 2

How to get the field name returned from get_data query in Python

Hi,

I am wondering if it is possible to return the requested field name from a get_data query in Python? In the Excel TR function I would use CH:fieldname, but adding 'Ch':'fieldname' to the get_data parameters in Python doesn't seem to work.

Any help much appreciated.

Thanks,

Nick

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.

Upvote
Accepted
3.8k 4 4 6

Hi @nickzane

You can add .fielddisplayname to the field parameter to get that info. You can also use .fielddescription for a more descriptive information.

Please see the example below:

ek.get_data('TRI.TO', ['TR.REVENUE','TR.REVENUE.fielddisplayname','TR.REVENUE.fielddescription'])

If you want to see what other suffixes can be added you check that using an Excel build formula tool.


output.jpg (175.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.

I should add to the response from @marcin.bunkowski that field display name appears as column name of the dataframe returned by get_data method. You can get the array of column names from the dataframe named df using df.columns.values.

that worked. thanks very much!

Upvotes
7 2 2 3

@Alex Putkov. @Zhenya Kovalyov Is it possible to change the field name to a custom name while fetching the data from Eikon?

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.

@deepika.naga.k

I don't think I understand the question. What do you mean by giving a custom name to a field? Would you mind elaborating? And please, whenever you have a new question, start a new thread. Threads that already have an accepted answer are not monitored by moderators. If you ask a new question on an existing thread, there's a high chance your questions will not be answered because nobody will have seen it. Not to mention that limiting a thread to one topic/issue makes the forum tidier and easier to use for people who look for answers to questions that have been previously asked.

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.