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?

Best Answer

  • jason.ramchandani01
    Answer ✓

    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.

Answers