@@ -360,11 +360,16 @@ def get_data_DEA(tech, data_in, expectation=None):
360
360
# replace missing data
361
361
df .replace ("-" , np .nan , inplace = True )
362
362
# average data in format "lower_value-upper_value"
363
- df = df .applymap (lambda x : (float ((x ).split ("-" )[0 ])
364
- + float ((x ).split ("-" )[1 ]))/ 2 if (type (x )== str and "-" in x ) else x )
363
+ df = df .apply (lambda row : row .apply (lambda x : (float (x .split ("-" )[0 ])
364
+ + float (x .split ("-" )[1 ]))
365
+ / 2 if isinstance (x , str ) and "-" in x else x ),
366
+ axis = 1 )
367
+
365
368
# remove symbols "~", ">", "<" and " "
366
369
for sym in ["~" , ">" , "<" , " " ]:
367
- df = df .applymap (lambda x : x .replace (sym ,"" ) if type (x )== str else x )
370
+ df = df .apply (lambda col : col .apply (lambda x : x .replace (sym , "" )
371
+ if isinstance (x , str ) else x ))
372
+
368
373
369
374
df = df .astype (float )
370
375
df = df .mask (df .apply (pd .to_numeric , errors = 'coerce' ).isnull (), df .astype (str ).apply (lambda x : x .str .strip ()))
@@ -436,7 +441,7 @@ def get_data_DEA(tech, data_in, expectation=None):
436
441
df_final .loc [index , :] = values
437
442
438
443
# if year-specific data is missing and not fixed by interpolation fill forward with same values
439
- df_final = df_final .fillna ( method = ' ffill' , axis = 1 )
444
+ df_final = df_final .ffill ( axis = 1 )
440
445
441
446
df_final ["source" ] = source_dict ["DEA" ] + ", " + excel_file .replace ("inputs/" ,"" )
442
447
if tech in new_format and (tech != "electrolysis" ):
@@ -773,6 +778,7 @@ def clean_up_units(tech_data, value_column="", source=""):
773
778
"MW" : "MW_e" }))
774
779
775
780
if "methanolisation" in tech_data .index :
781
+ tech_data = tech_data .sort_index ()
776
782
tech_data .loc [('methanolisation' , 'Variable O&M' ), "unit" ] = "EUR/MWh_MeOH"
777
783
778
784
return tech_data
@@ -945,7 +951,7 @@ def order_data(tech_data):
945
951
if len (investment ):
946
952
fixed = df [(df .index .str .contains ("Fixed O&M" ) |
947
953
df .index .str .contains ("Total O&M" )) &
948
- ((df .unit == investment .unit [0 ]+ "/year" )|
954
+ ((df .unit == investment .unit . iloc [0 ]+ "/year" )|
949
955
(df .unit == "EUR/MW/km/year" )|
950
956
(df .unit == "EUR/MW/year" )|
951
957
(df .unit == "EUR/MW_e/y, 2020" )|
@@ -954,7 +960,7 @@ def order_data(tech_data):
954
960
(df .unit == "EUR/MW_MeOH/year" )|
955
961
(df .unit == "EUR/MW_CH4/year" )|
956
962
(df .unit == '% of specific investment/year' )|
957
- (df .unit == investment .unit .str .split (" " )[0 ][0 ]+ "/year" ))].copy ()
963
+ (df .unit == investment .unit .str .split (" " ). iloc [0 ][0 ]+ "/year" ))].copy ()
958
964
if (len (fixed )!= 1 ) and (len (df [df .index .str .contains ("Fixed O&M" )])!= 0 ):
959
965
switch = True
960
966
print ("check FOM: " , tech , " " ,
@@ -1165,7 +1171,7 @@ def add_gas_storage(data):
1165
1171
gas_storage .dropna (axis = 1 , how = "all" , inplace = True )
1166
1172
1167
1173
# establishment of one cavern ~ 100*1e6 Nm3 = 1.1 TWh
1168
- investment = gas_storage .loc ['Total cost, 100 mio Nm3 active volume' ][0 ]
1174
+ investment = gas_storage .loc ['Total cost, 100 mio Nm3 active volume' ]. iloc [0 ]
1169
1175
# convert million EUR/1.1 TWh -> EUR/kWh
1170
1176
investment /= (1.1 * 1e3 )
1171
1177
data .loc [("gas storage" , "investment" ), years ] = investment
@@ -2101,7 +2107,7 @@ def geometric_series(nominator, denominator=1, number_of_terms=1, start=1):
2101
2107
# rename + reorder to fit to other data
2102
2108
costs_vehicles = rename_ISE_vehicles (costs_vehicles )
2103
2109
if 'NT' in costs_vehicles .index :
2104
- costs_vehicles .drop (['NT' ], axis = 0 , inplace = True )
2110
+ costs_vehicles .drop (['NT' ], axis = 0 , inplace = True , level = 0 )
2105
2111
costs_vehicles = convert_units (costs_vehicles )
2106
2112
# add costs for vehicles
2107
2113
data = pd .concat ([data , costs_vehicles ], sort = True )
0 commit comments