Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvote
Accepted
22 1 0 5

How to insert a date column with rd.get_data

Hello everyone

I would like to get a time series with get_data. I would like to have the P/E ratio of the last 3 years.

I use the following code:

import refinitiv.data as rd

rd.open_session()
df = rd.get_data(
    universe = ['LISN.S'],
    fields = ['TR.PE'],
    parameters = {
        'SDate': '2020-12-31',
        'EDate': '-1D',
        'Frq': 'D'
    }
)

display(df)


I also get the P/E of the last 3 years, but I don't get any dates. I had this problem before and I was told that I just have to add .fperiod. But this does not work with TR.PE.

What do I have to do so that when I work with a start and end date, the date is always displayed.

Many thanks

codebook
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
Accepted
5.8k 21 2 6

Hi @michael.mauchle ,

I would advise using the get_history function. For more info on that function, please look into CodeBook's example:
__Examples__/01. Data Retrieval and Discovery/01.01. Refinitiv Data Library/Access__Get_History.ipynb

rd.get_history(
    universe=["LISN.S"],
    fields=["TR.PE"],
    interval="1D",
    start="2020-12-31",
    end="2023-12-31")


1701712427262.png


1701712427262.png (21.5 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.

Hi, I'm having a similar problem, but when I try to get the data with the rd.get_history(), it's not work, as you can see below:

1702568556228.png

How can I pull this EPS data like in the rd.get_data(), but with the date column appears?

1702568556228.png (56.9 KiB)

P.S.: I found a old tutorial with the ek.get_data where the get_data automatically create a 'Calc Date' column, available in https://github.com/LSEG-API-Samples/Article.EikonAPI.Python.WorkingWithFundamentalandEstimatesDCF/blob/main/Working%20with%20Fundamentals%20and%20Estimates%20Data%20-%20A%20DCF%20Example.ipynb


1702568626449.png
Does exists any similar way to do this with rd.get_data()?

Thanks!

1702568626449.png (137.6 KiB)

Hi @manuel.alvarez,

Please have a look at this tutorial page, where you can see how one can use the `get_data` function as you ask. In this instance, the Eikon and RD libraries work in very similar ways.

I would also suggest watching this DIB video, that relates to your inquiry.

In simple form, I think that wnat you are after is the parameters argument:


import refinitiv.data as rd
rd.open_session()

rd.get_data(
    universe=["VOD.L"],
    fields=["TR.RevenueMean(Period=FY1).calcdate",
            "TR.RevenueMean(Period=FY1)"],
    parameters={
        # 'Curn': 'CAD',
        # 'Frq': "1D"
        'SDate': '-2000', # "2023-11-01",
        'EDate': '0', # "2023-12-11",
        })


1702891095968.png


1702891095968.png (25.3 KiB)

Hi! Thanks! That was exactly what I needed.


But, about the different outputs that are possible to get in fields parameters, like "date", "calcdate", "value", etc.

Where can I found some detailed explanation about each of these fields parameters?

Show more comments
Upvotes
22 1 0 5

Thank you - this is how it works

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.