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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 1 1 2

Get_data change the column name

data, err=ek.get_data(list_stocks,[                             'TR.NetProfitRepActValue(Period=FY-1,Curn=EUR)',                             'TR.NetProfitRepActValue(Period=FY0,Curn=EUR)'                            ])

I have the following code but in data frame both coums will have the same name "Net Income Reported - Actual". I would like to customize( eg Net Income last year; Net income this year) the name already when I extract from get_data. Is that possible?

eikoneikon-data-apipythonworkspacerefinitiv-dataplatform-eikonworkspace-data-apiapi
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
7.6k 10 6 8

Hi @ecaterina.biris Thanks for your question - the simplest way is to actually set the column names to what you want them to be - please see code below:

data, err=ek.get_data('VOD.L',['TR.NetProfitRepActValue(Period=FY-1,Curn=EUR)','TR.NetProfitRepActValue(Period=FY0,Curn=EUR)'])

data.columns = ['Instrument','Net - Last Year','Net - this year']

data

I hope this can help.

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
18.1k 21 12 20

Hi @ecaterina.biris

You can rename the column by position (1 or 2 in the sample code below):


ahs.png (25.0 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
3 1 1 2

Thanks for the solutions. I just hoped that within get_data is a field that can be renamed

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.