Учитывая следующий фрейм данных:
df = pd.DataFrame({'doc' : ['2739','2697','3135','896'],
'tool' : ["system: 15", "architectur: 5" ,"tool: 10", "tool: 11"],
'system' : ["tool: 1", "tool: 3" , "system: 5", "system: 14"],
'architectur' : ["architectur: 4", "system: 28", "architectur: 3", "architectur: 10"]})
df = df.set_index('doc')
print(df)
tool system architectur
doc
2739 system: 15 tool: 1 architectur: 4
2697 architectur: 5 tool: 3 system: 28
3135 tool: 10 system: 5 architectur: 3
896 tool: 11 system: 14 architectur: 10
Я пытаюсь изменить порядок строк в соответствии с соответствующими строками из имени столбца.
Конечная цель заключается в следующем:
tool system architectur
doc
2739 tool: 1 system: 15 architectur: 4
2697 tool: 3 system: 28 architectur: 5
3135 tool: 10 system: 5 architectur: 3
896 tool: 11 system: 14 architectur: 10
Заранее спасибо!