question

Upvotes
Accepted
1 0 0 0

Snapping zero-values with the Python RD library

Hi devs,

There is a critical bug in the newly released refinitiv-data Python library, where zero-values are snapped as pd.NA. The error is caused by the highlighted snippet in refinitiv\data\content\_universe_streams.py in the build_df method.

data = (
        (inst_name, *(values.pop(0) or pd.NA for values in values_by_field.values()))
        for inst_name in universe
    )

This is a common antipattern, where falsy values are nullified. Unfortunately this causes valid data, e.g. 0, to be nullified in the output.

There was a similar error in the alpha version of refinitiv-dataplatform (v.1.0.0.a10, Snapping zero-values with the Python RDP library - Forum | Refinitiv Developer Community).

Please add a unit test to ensure that this bug doesn't keep reappearing.

python#productrefinitiv-dataplatform-libraries
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
14.3k 30 5 10

Hi @Philip Voldsgaard ,

Sorry for this issue. I've reported this to the related team already and I will keep you updated.

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
14.3k 30 5 10

Hi @Philip Voldsgaard ,

Thank you for raising this, please be informed that this issue has been fixed in RD Python 1.1.0

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.