ek.get_data NON FILL "TR.ExchangeCountry" when using parameters (for each row)

Hi all and thanks in advance.

Is there a way for fill "TR.ExchangeCountry" for each row line of the following dataframe?

df, err = ek.get_data("ENI.MI", ["TR.DivAdjustedGross","TR.DivExDate","TR.DivPayDate","TR.DivType","TR.DivAnnouncementDate","TR.DivEventStatus","TR.ExchangeCountry"], parameters = {'SDate': '1950-01-01', 'EDate': '3000-01-01'})

Best Answer

  • aramyan.h
    Answer ✓

    Hi @Nabil Edriss Sanchez1 ,


    Thank you for your question. Since TR.ExchangeCountry doesn't support time series you get the value for the first row and the rest is returned as empty strings. Unfortunately, I couldn't find a direct way of filling these empty cells directly from API. However, one approach I could think of is replacing the empty fields by np.nan and filling forward nan fields using the code below:

    import numpy as np
    df['Country of Exchange'].replace('', np.nan, inplace = True)
    df['Country of Exchange'].fillna(method = 'ffill', inplace = True)
    df

    screenshot-2023-03-16-at-153748.png

    This will do the job also if you ask the data for multiple RICs.


    Hope this was helpful, let me know should you have any further questions.


    Best regards,

    Haykaz

Answers

  • A similar pandas solution was also what I did. But with your answer (thank you very much) now I see there is no other Eikon parameter for solve it directly.


    Have a nice day.