我有以下df
:
df
Site Process parameter value unit
0 Mid Biomass plant cap-up 5000.00
1 Mid Biomass plant inv-cost 875000.00
2 Mid Biomass plant depreciation 25.00
3 Mid Coal plant cap-up 0.00
4 Mid Coal plant inv-cost 600000.00
5 Mid Coal plant depreciation 40.00
我想要一个unit
的df,如下所示:
df_unit
unit
0 MW
1 €/MWh
2 a
我想把df
和df_unit
合并在一起。可能是用熊猫做这个的最好方法,但我不知道怎么用。那么你能帮我从df
和df_unit
得到下面的df_merged
吗?你知道吗
以下输出是预期结果。你知道吗
df_merged
Site Process parameter value unit
0 Mid Biomass plant cap-up 5000.00 MW
1 Mid Biomass plant inv-cost 875000.00 €/MWh
2 Mid Biomass plant depreciation 25.00 a
3 Mid Coal plant cap-up 0.00 MW
4 Mid Coal plant inv-cost 600000.00 €/MWh
5 Mid Coal plant depreciation 40.00 a
在您的评论中,您提到要将其指定给正确的参数。所以,在units数据框中需要一个参数列。你知道吗
假设你有一个
步骤1:-使用字典并读取其中的单元数据帧。你知道吗
上面的代码所做的是,它希望在units数据框中的参数列和单位列之间创建一个项目zip。你知道吗
步骤2:-现在调用数据帧内的字典
上面的代码所做的是,将字典映射到实际数据帧上的参数列,并将其添加为新列。你知道吗
如果你对此有任何疑问,请告诉我。你知道吗
相关问题 更多 >
编程相关推荐