私の個人的な好みに基づいてパンダデータフレームの列を並べ替える方法はありますか(つまり、アルファベット順または数値順ではなく、特定の規則に従うような方法)?
簡単な例:
frame = pd.DataFrame({
'one thing':[1,2,3,4],
'second thing':[0.1,0.2,1,2],
'other thing':['a','e','i','o']})
これを生成します:
one thing other thing second thing
0 1 a 0.1
1 2 e 0.2
2 3 i 1.0
3 4 o 2.0
しかし、代わりに、私はこれを望みます:
one thing second thing other thing
0 1 0.1 a
1 2 0.2 e
2 3 1.0 i
3 4 2.0 o
(このケースに固有のものではなく、一般的な解決策を提供してください。感謝します。)