1 回答
TA贡献1820条经验 获得超10个赞
您已关闭,需要将parameter列添加到列表中,选择value之前unstack和最后使用的列reset_index以rename_axis进行数据清理:
df = (data.set_index(['Site', 'Storage','Commodity','parameter'])['value']
.unstack()
.reset_index()
.rename_axis(None, axis=1))
print (df)
Site Storage Commodity cap-lo-c cap-lo-p cap-up-c depreciation discharge \
0 Mid Pump Elec 0 0 1.5e+15 NaN NaN
1 South Pump Elec NaN NaN NaN 50 3.5e-06
ep-ratio init inst-cap-c inst-cap-p wacc
0 NaN NaN 0 0 NaN
1 None 1 NaN NaN 0.07
添加回答
举报
