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

Upvotes
Accepted
20 2 2 3

ValueError when retrieving timeseries

When I try to request timeseries via ek.get_timeseries a ValueError is thrown (only for specific stocks/parameters).


Example snippet with traceback:

>>> ek.get_timeseries(rics=['GHG.BH'], fields=['OPEN', 'CLOSE'], count=5)
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1677, in create_block_manager_from_blocks
    make_block(values=blocks[0], placement=slice(0, len(axes[0])))
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\blocks.py", line 3265, in make_block
    return klass(values, ndim=ndim, placement=placement)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\blocks.py", line 128, in __init__
    "{mgr}".format(val=len(self.values), mgr=len(self.mgr_locs))
ValueError: Wrong number of items passed 1, placement implies 2

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\eikon\time_series.py", line 206, in get_timeseries
    data_frame = NiceDataFrame_Formatter(ts_result).get_data_frame()
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\eikon\time_series.py", line 257, in get_data_frame
    data_frames, rics, fields = self._get_frame_list()
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\eikon\time_series.py", line 290, in _get_frame_list
    df = pd.DataFrame(datapoints, columns=fields)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\frame.py", line 439, in __init__
    mgr = init_ndarray(data, index, columns, dtype=dtype, copy=copy)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\construction.py", line 213, in init_ndarray
    return create_block_manager_from_blocks(block_values, [columns, index])
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1687, in create_block_manager_from_blocks
    construction_error(tot_items, blocks[0].shape[1:], axes, e)
  File "C:\Program Files (x86)\Python37-32\lib\site-packages\pandas\core\internals\managers.py", line 1716, in construction_error
    raise ValueError("Empty data passed with indices specified.")
ValueError: Empty data passed with indices specified.


It seems like the reason for the error is that there are no up-to-date quotes (latest GHG.BH quote is from 2019-11-04) and the number of returned rows is limited via the count param.

The ValueError is also thrown when data for multiple rics is requested, so one 'bad' ric that has no current quotes crashes the whole batch-query. I am pretty sure that this behaviour is not intended and that it should be fixed.

I've tested it on eikon version 1.0.1 and pre-release 1.1.2b0. If necessary I can provide additional examples (e.g. other rics that cause the same behaviour).


eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-apierror
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 @Olivier DAVANT

Please confirm if this is an issue and provide ETA of fixes if possible.

Thanks.

<ahs>

submitted 082088882 case on behalf of client.

Hello @gabriel.g

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Upvotes
Accepted
18.2k 21 13 21

Hi @gabriel.g

Thanks for reporting this.

I can reproduce the same error.


I cannot confirm if this is an intended behavior but I will inform product manager to be aware of this issue.


ahs.png (60.9 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.

In the case for this issue, solution is Eikon Python Dev released the fix server-side

Upvotes
20 2 2 3

Great, thank you!

As already mentioned it's mainly a problem when requesting quotes for a bunch of rics at once.
The ValueError gives no insight on which instrument caused the error, so I have to sequentially send a request for every single ric to find the culprit.

I'll probably write some kind of binary-search algorithm to circumvent it, but I'd still appreciate if you informed me on any news on this issue (e.g. by posting another reply into this thread).

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.