question

Upvotes
Accepted
31 4 4 7

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?

#technology#productrdp-apifundamental-data
1690204843578.png (92.0 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.

Upvote
Accepted
87.5k 294 53 79

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)
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
31 4 4 7

Thank You for the solution. It works fine.

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.