Fix copy_timeslice

copy timeslice would add data although country not present in load
This commit is contained in:
Johannes Schmidt 2024-05-06 13:37:32 +02:00 committed by GitHub
parent 315f5ef64f
commit 9d36d2bc9b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -129,7 +129,7 @@ def copy_timeslice(load, cntry, start, stop, delta, fn_load=None):
load.loc[start:stop, cntry] = load.loc[
start - delta : stop - delta, cntry
].values
elif fn_load is not None:
elif fn_load is not None and cntry in load:
duration = pd.date_range(freq="h", start=start - delta, end=stop - delta)
load_raw = load_timeseries(fn_load, duration, [cntry])
load.loc[start:stop, cntry] = load_raw.loc[