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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 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-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikonpythonapi
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
6.7k 8 6 7

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 5.0 MiB each and 10.0 MiB total.

Upvote
18k 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 5.0 MiB each and 10.0 MiB total.

Upvotes
3 0 0 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 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea