I have a DataFrame, df, that I want to sort by both columns and rows at the same time.
data = {'c2': ['4.0', '2.0', '1.0', '3.0'],
'c1': ['200', '100', '300', '400'],
'c3': ['aa', 'cc', 'dd', 'ee']}
df = pd.DataFrame(data)
df.index = ['d', 'b', 'c', 'a']
df
I have no problem sorting by either of them, but I cannot figure out how to get them sorted at the same time. I would like the output to have the columns sorted by 'c1', 'c2', 'c3' and the rows to be 'a', 'b', 'c', 'd'. Don't think it is very difficult but I cannot figure out how to do it.