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.

Best Answer

Answers