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

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 5.0 MiB each and 10.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 1 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 5.0 MiB each and 10.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.

Click below to post an Idea Post Idea