I have a dataframe df with the columns
cycle_end_date | trigger | deliver | cost
when i do df.transpose()
I get the following result
cycle_end_date_1 | cycle_end_date_2 | cycle_end_date_3
cost
deliver
trigger
which is fine but how do i preserve the sequence of my index? It should come in the same sequence that is trigger, deliver, cost
Any idea?
CodePudding user response:
Using .loc should let you reorder the indexes:
df.loc[['cost', 'deliver', 'trigger']]