How to workaround problem with different timeseries?

When I query:

df = ek.get_timeseries(["LP40214720", "BCEI.N"],
start_date="1900-01-01")

I get an error withing pandas multi-index.

ValueError: Length mismatch: Expected axis has 1 elements, new values have 6 elements.

It is a bad idea to assume that data frames have the same fields (moreover have the same number of fields).

The workaround is to change Eikon time_series.py line number 315:

columns = [(ric_name, f) for f in fields]

with

columns = [(ric_name, f) for f in df.columns]

Now the code works just fine. Also, multi-index is working as should (when you select the first security from df only one column appears when the second six columns appear.). But be aware when dealing with securities with different past length (a NaN appears).

Best Answer

  • Hi @mzeman

    Thanks for sharing and provided a workaround.

    I can confirm that I can reproduce the same issue with yours.


    This is output on each RIC code:

    image


    This is an issue when mixed these 2 RIC codes:

    image


    I have raised this issue to product support group.

    Thanks and have a good day !

Answers