我有以下场景:我有一个train.csv文件,如下所示。每行被提及4次,索引值相同
Index sentence ending0 ending1 ending2 ending3
0 ABC DEF GHI JKL MNO
0 ABC DEF GHI JKL MNO
0 ABC DEF GHI JKL MNO
0 ABC DEF GHI JKL MNO
1 LKJ KJS AJA QHW IUH
... ... ... ... ... ...
...
...
2
...
...
...
我想要得到的如下所示:
Index sentence ending-id ending
0 ABC 0 DEF
0 ABC 1 GHI
0 ABC 2 JKL
0 ABC 3 MNO
1 LKJ 0 KJS
... ... ... ...
...
...
您可以尝试以下方法:
输出:
到目前为止,我用这段代码得到了以下结果
我希望得到如下结果:
相关问题 更多 >
编程相关推荐