ZAV with RDP API doesn't work as expected

I tried to receive some data with a ZAV like in Excel, but only the first value with "NA" is replaced by 0.
This is the program:

currency = "EUR"

co2_fields = ["ZAV(""TR.AnalyticEstimatedCO2Total"")","ZAV(""TR.CarbonOffsetsCredits"")",\

"TR.AnalyticEstimatedCO2Total","TR.CarbonOffsetsCredits"]

as_of_date = "2023-06-30"

freq = "FY"

period = "FY0, FY-2"

co2_result = fundamental_and_reference.Definition(

universe = ric_liste,

fields = co2_fields,

parameters = {"Scale": 6, "SDate": as_of_date, "Period": period, \

"FRQ": freq, "Curn": currency, "IncludePartial": "No"}

).get_data()

use_field_names_in_headers = True

co2_result.data.df


And this is the output:

1690204843578.png


So for ZAV(TR.CarbonOffsetsCredits) for FY-1 and FY-2 there are <NA>-values returned instead of 0.

What is wrong?

Best Answer

  • Jirapongse
    Answer ✓

    As I know, the fundamental_and_reference services on the desktop and RDP sessions are different. The code that works on the desktop session may not work on the RDP session.

    According to this discussion, the fillna(0) method can be used to fill <NA> with zero.

    df["<column name>"] = df["<column name>"].fillna(0)

Answers