I have a dataframe with one column, which I would like to sort. Typing following code gives me a sorted dataframe:
sort = tst.sort([\"Mean\"], ascending = F
I think you can select first column by tst.columns[0]
, better is use sort_values because sort
return warning:
FutureWarning: sort(columns=....) is deprecated, use sort_values(by=.....)
sort = tst.sort_values(tst.columns[0], ascending = False)
print (tst)
Mean
SIMULATION
Sim_213 0.845990
Sim_758 1.351917
Sim_830 0.921284
Sim_295 0.870272
Sim_215 1.072942
Sim_830 0.921284
Sim_295 0.870272
Sim_440 0.822394
print (tst.columns[0])
Mean
sort = tst.sort_values(tst.columns[0], ascending = False)
print (sort)
Mean
SIMULATION
Sim_758 1.351917
Sim_215 1.072942
Sim_830 0.921284
Sim_830 0.921284
Sim_295 0.870272
Sim_295 0.870272
Sim_213 0.845990
Sim_440 0.822394