Merge pull request #861 from PyPSA/fix_clustering

fix clustering bug due to missing countries in n.buses
This commit is contained in:
Fabian Neumann 2024-01-18 19:34:59 +01:00 committed by GitHub
commit 85ecb1355a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -560,7 +560,7 @@ def _set_countries_and_substations(n, config, country_shapes, offshore_shapes):
~buses["under_construction"]
)
c_nan_b = buses.country == "na"
c_nan_b = buses.country.fillna("na") == "na"
if c_nan_b.sum() > 0:
c_tag = _get_country(buses.loc[c_nan_b])
c_tag.loc[~c_tag.isin(countries)] = np.nan