compute lifetime after grouping DateIn
This commit is contained in:
parent
986c7be48e
commit
7f5f0ee45e
@ -171,9 +171,7 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
|
|||||||
phased_out = df_agg[df_agg["DateOut"] < baseyear].index
|
phased_out = df_agg[df_agg["DateOut"] < baseyear].index
|
||||||
df_agg.drop(phased_out, inplace=True)
|
df_agg.drop(phased_out, inplace=True)
|
||||||
|
|
||||||
# calculate remaining lifetime before phase-out (+1 because assuming
|
|
||||||
# phase out date at the end of the year)
|
|
||||||
df_agg["lifetime"] = df_agg.DateOut - df_agg.DateIn + 1
|
|
||||||
|
|
||||||
# assign clustered bus
|
# assign clustered bus
|
||||||
busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze()
|
busmap_s = pd.read_csv(snakemake.input.busmap_s, index_col=0).squeeze()
|
||||||
@ -195,6 +193,10 @@ def add_power_capacities_installed_before_baseyear(n, grouping_years, costs, bas
|
|||||||
grouping_years, np.digitize(df_agg.DateIn, grouping_years, right=True)
|
grouping_years, np.digitize(df_agg.DateIn, grouping_years, right=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# calculate (adjusted) remaining lifetime before phase-out (+1 because assuming
|
||||||
|
# phase out date at the end of the year)
|
||||||
|
df_agg["lifetime"] = df_agg.DateOut - df_agg["grouping_year"] + 1
|
||||||
|
|
||||||
df = df_agg.pivot_table(
|
df = df_agg.pivot_table(
|
||||||
index=["grouping_year", "Fueltype"],
|
index=["grouping_year", "Fueltype"],
|
||||||
columns="cluster_bus",
|
columns="cluster_bus",
|
||||||
|
Loading…
Reference in New Issue
Block a user