Skip to content

Commit

Permalink
assume 0 for countries with missing data
Browse files Browse the repository at this point in the history
  • Loading branch information
yerbol-akhmetov committed Oct 18, 2024
1 parent baa8500 commit c25aa26
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions scripts/build_industry_demand.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,10 @@ def match_technology(df):
"production[ktons/a]"
]

# Check for duplicate entries per country
duplicates = AL_prod_tom.index[AL_prod_tom.index.duplicated(keep=False)].unique()
if len(duplicates) > 0:
raise ValueError(
f"There are more than one entry for aluminium production data for the following countries: {', '.join(duplicates)} in 'data/AL_production.csv'"
)
# Check if aluminum data is missing for any countries
for country in countries_geo:
if country not in AL_prod_tom.index:
_logger.warning(f"No aluminum production data found for {country}. Filled with 0.0.")

# Reindex and fill missing values with 0.0
AL_prod_tom = AL_prod_tom.reindex(countries_geo, fill_value=0.0)
Expand Down

0 comments on commit c25aa26

Please sign in to comment.