diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 0d1b7c746..8f93f3825 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -42,6 +42,8 @@ E.g. if a new rule becomes available describe how to use it `make test` and in o * Fix bugs in `prepare_sector_network.py` related to links with H2 buses and bug of re-addition of H2 and battery carriers in present `PR #1145 `_ +* Drop entries that contain non-string elements in country column of `CO2_emissions_csv` data in `prepare_transport_data_input.py` script `PR #1166 `_ + PyPSA-Earth 0.4.1 ================= diff --git a/scripts/prepare_transport_data_input.py b/scripts/prepare_transport_data_input.py index cffa163e2..93f570d70 100644 --- a/scripts/prepare_transport_data_input.py +++ b/scripts/prepare_transport_data_input.py @@ -103,6 +103,13 @@ def download_CO2_emissions(): # Drop region names that have no ISO2: CO2_emissions = CO2_emissions[CO2_emissions.country != "not found"] + # Drop region names where country column contains list of countries + CO2_emissions = CO2_emissions[ + CO2_emissions.apply( + lambda x: False if not isinstance(x.country, str) else True, axis=1 + ) + ] + return CO2_emissions