You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks a lot for this great library :). I was using the latest github version but noticed that the test suite is broken. Maybe it could be good to add a github workflow running the test suite? Or at least to fix the test/code to show the correct intent :).
One of the cases I have in mind is (It's not the only one that needs fixing if I am not mistaken)
company_name
company_id
isic
target_type
intensity_metric
scope
emissions_in_scope
reduction_ambition
base_year
start_year
end_year
achieved_reduction
target_status
time_frame
industry
ghg_s1s2
ghg_s3
company_market_cap
investment_value
portfolio_weight
company_cash_equivalents
company_enterprise_value
company_ev_plus_cash
company_total_assets
sbti_validated
Company T
CA0000000020
A12
Absolute
Revenue
S1+S2
100
0.416
2009
2009
2020
0.68
Underway
short
test
28400000
28400000
66682
18472
0.055325267
22005.06
15403.542
62681.08
60680.62
1
One line of the data_test_temperature_score.csv file
Here the end_year is 2020. If we go into
defget_annual_reduction_rate(self, target: pd.Series) ->Optional[float]:
""" Get the annual reduction rate (or None if not available). :param target: The target as a row of a dataframe :return: The annual reduction """# 2022-09-01 Bloomberg pointed out need for additional checks in input# Here is the original code:# if pd.isnull(target[self.c.COLS.REDUCTION_AMBITION]):# return None# try:# return target[self.c.COLS.REDUCTION_AMBITION] / float(# target[self.c.COLS.END_YEAR] - target[self.c.COLS.BASE_YEAR]# )# except ZeroDivisionError:# raise ValueError(# "Couldn't calculate the annual reduction rate because the start and target year are the "# "same"# )# Bloombergs proposal - changed 2022-09-01check=pd.isnull(target[self.c.COLS.REDUCTION_AMBITION])
check=checkorpd.isnull(target[self.c.COLS.END_YEAR])
check=checkorpd.isnull(target[self.c.COLS.BASE_YEAR])
check=checkor (target[self.c.COLS.END_YEAR] <=target[self.c.COLS.BASE_YEAR])
# add check that target is not too oldcheck=checkor (target[self.c.COLS.END_YEAR] <datetime.datetime.now().year)
ifcheck:
returnNonereturntarget[self.c.COLS.REDUCTION_AMBITION] /float(
target[self.c.COLS.END_YEAR] -target[self.c.COLS.BASE_YEAR]
)
# End of BBGs code
We see that the last check puts NaN into self.c.COLS.ANNUAL_REDUCTION_RATE, thus giving a final temperature of 3.2, whereas in the test we find:
Thanks for bringing this up; and sorry for the very late response.
Obviously, a target with an end date in 2020 would be invalid. So we'll take a look at updating the test file as well as finding some enhanced workflow.
Hi!
Thanks a lot for this great library :). I was using the latest github version but noticed that the test suite is broken. Maybe it could be good to add a github workflow running the test suite? Or at least to fix the test/code to show the correct intent :).
One of the cases I have in mind is (It's not the only one that needs fixing if I am not mistaken)
One line of the
data_test_temperature_score.csv
fileHere the
end_year
is 2020. If we go intoWe see that the last check puts
NaN
intoself.c.COLS.ANNUAL_REDUCTION_RATE
, thus giving a final temperature of 3.2, whereas in the test we find:1.77 :)
The text was updated successfully, but these errors were encountered: