Skip to content

Commit 6e5066b

Browse files
authored
Merge pull request #126 from koen-vg/keep-index-names
Make sure to keep "technology" and "parameter" multiindex names
2 parents 09e85a6 + 3a418ee commit 6e5066b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scripts/compile_cost_assumptions.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,7 @@ def add_egs_data(data):
17021702
"""
17031703
parameters = ["CO2 intensity", "lifetime", "efficiency residential heat", "efficiency electricity", "FOM"]
17041704
techs = ["geothermal"]
1705-
multi_i = pd.MultiIndex.from_product([techs, parameters])
1705+
multi_i = pd.MultiIndex.from_product([techs, parameters], names=["technology", "parameter"])
17061706
geoth_df = pd.DataFrame(index=multi_i, columns=data.columns)
17071707
years = [col for col in data.columns if isinstance(col, int)]
17081708

@@ -1855,7 +1855,7 @@ def add_SMR_data(data):
18551855
"""
18561856
parameters = ["FOM", "investment", "lifetime", "efficiency"]
18571857
techs = ["SMR", "SMR CC"]
1858-
multi_i = pd.MultiIndex.from_product([techs, parameters])
1858+
multi_i = pd.MultiIndex.from_product([techs, parameters], names=["technology", "parameter"])
18591859
SMR_df = pd.DataFrame(index=multi_i, columns=data.columns)
18601860

18611861
# efficiencies per unit in LHV (stays constant 2019 to 2050)
@@ -1912,6 +1912,7 @@ def add_mean_solar_rooftop(data):
19121912
rooftop["source"] = "Calculated. See 'further description'."
19131913
rooftop["further description"] = "Mixed investment costs based on average of 50% 'solar-rooftop commercial' and 50% 'solar-rooftop residential'"
19141914
# add to data
1915+
rooftop.index.names = data.index.names
19151916
data = pd.concat([data, rooftop])
19161917
# add solar assuming 50% utility and 50% rooftop
19171918
solar = (data.loc[["solar-rooftop", "solar-utility"]][years]).astype(float).groupby(level=1).mean()
@@ -1921,6 +1922,7 @@ def add_mean_solar_rooftop(data):
19211922
solar["further description"] = "Mixed investment costs based on average of 50% 'solar-rooftop' and 50% 'solar-utility'"
19221923
# set multi index
19231924
solar = pd.concat([solar], keys=["solar"])
1925+
solar.index.names = data.index.names
19241926
return pd.concat([data, solar])
19251927

19261928

0 commit comments

Comments
 (0)