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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
3 0 0 1

Manipulating get_data returns for fiancial data Series (TR.F...)

Trying to get historic financial data for many asset, one field.

Example:

dfEikonTHIS, err = ek.get_data('NESN.S,CSGN.S','TR.F.CF(SDate=0,EDate=-10,Period=FY0,Frq=FY)', parameters=None, field_name=False)

How can I get it to return ASSET as row and each element of FIELD as as columns ... without parsing through the data returned and reformat?

not this


InstrumentCash Flow0NESN.S235580000001NESN.S158370000002NESN.S166170000003NESN.S143920000004NESN.S10653000000


But this


01234NESN.S
2355800000015837000000166170000001439200000010653000000



eikon-data-apipython api
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
52.8k 135 44 63

@the.swiss

The get_data method returns data in the following format.

dfEikonTHIS, err = ek.get_data('NESN.S,CSGN.S',['TR.F.CF(SDate=0,EDate=-10,Period=FY0,Frq=FY).Date',
                                               'TR.F.CF(SDate=0,EDate=-10,Period=FY0,Frq=FY)'], parameters=None, field_name=False)
dfEikonTHIS

1650856380017.png

This can't be changed. However, you can use the pivot method to change the format, as shown below.

dfEikonTHIS.pivot(index='Instrument', columns='Date', values='Cash Flow') 

The output looks like this.

1650856435962.png



1650856380017.png (27.0 KiB)
1650856435962.png (10.8 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 0 0 1

Many thanks - belatedly - had to go a different route (from pivot ... the term gives me a jolt being an old Excel finance junkie .. ;-) )

I am using dates 'normalized' as in T-x x being years so those columns would read 0,1,2, ...

Alfred

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.