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

Best Answer

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

    image

Answers

  • 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!

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

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