【发布时间】:2023-03-09 21:54:02
【问题描述】:
对于给定的数据框:
UUT testa testb testc testd
DateTime
2017-11-21 18:47:29 1.0 1.0 1.0 3.0
2017-11-21 18:47:30 1.0 2.0 1.0 4.0
2017-11-21 18:47:31 1.0 2.0 5.0 2.0
2017-11-21 18:47:32 1.0 2.0 5.0 1.0
2017-11-21 18:47:33 1.0 2.0 5.0 4.0
2017-11-21 18:47:34 1.0 2.0 5.0 1.0
无论如何我要如何手动重新排列列 例如,如果我想要以下顺序:
testc, testd, testa, testb
所以表格和情节会是这样的:
UUT testc testd testa testb
DateTime
2017-11-21 18:47:29 1.0 3.0 1.0 1.0
2017-11-21 18:47:30 1.0 4.0 1.0 2.0
2017-11-21 18:47:31 5.0 2.0 1.0 2.0
2017-11-21 18:47:32 5.0 1.0 1.0 2.0
2017-11-21 18:47:33 5.0 4.0 1.0 2.0
2017-11-21 18:47:34 5.0 1.0 1.0 2.0
【问题讨论】:
标签: python pandas sorting pivot-table