diff --git a/RatingData/scripts/esg/environment.py b/RatingData/scripts/esg/environment.py index 0f39aa5..7a4cec2 100644 --- a/RatingData/scripts/esg/environment.py +++ b/RatingData/scripts/esg/environment.py @@ -54,7 +54,12 @@ def environment_co2(param): res = dict() res['amount'] = amount # 每年每万元收入二氧化碳排放量 - res['money_amount'] = round(amount / income, 2) + # res['money_amount'] = round(amount / income, 2) + num = 2 + while round(amount / income, num) == 0.0: + num += 1 + res['money_amount'] = round(amount / income, num+1) + return res def calculate_three_year_data(): @@ -152,7 +157,7 @@ def environment_energy(param): # 每年能耗 amount = sum(total) res = dict() - res['amount'] = amount + res['amount'] = round(amount, 2) # 每年每万元收入能耗 res['money_amount'] = round(amount / income, 2) return res