Pandas sort_index numerically, not lexicographically
you have 2 types of index, either row index (axis=0) or columns index (axis=1)
you are just arranging columns by name when you use axis=1. it does not reorder each row by values. check your columns names after your sort_index(axis=1) and you will understang
I'm having some issues with sorting a pandas dataframe.
sort_index(axis=0) results in the dataframe sorting the index as 1 10 11 12 13... etc.
While sort_index(axis=1) seems to work for the first couple of rows and then it gets completely disordered.
I simply cannot wrap my head around what is going on. I want a simply numerical sorting of my indices, it seems that it ought to be the standard setting for sort_index.