I have to sort a data frame on column 1 and 2; column 1 contains numbers and text, which should first be numerically sorted. In excel this is the standard way to sort, but not in pandas.. I couldn't find much info on how to do this in the pandas manual..
So this dataframe:
Z 762320 296 1
Z 861349 297 0
1 865545 20 20
1 865584 297 0
22 865625 297 0
2 865628 292 5
10 865662 297 0
1 865665 296 0
11 865694 293 1
1 865700 297 0
10 866429 297 0
11 866438 297 0
should be:
1 865545 20 20
1 865584 297 0
1 865665 296 0
1 865700 297 0
2 865628 292 5
10 865662 297 0
10 866429 297 0
11 865694 293 1
11 866438 297 0
22 865625 297 0
Z 762320 296 1
Z 861349 297 0
when i do df.sort([0,1]) i get:
0 1 2 3
1 1 865545 20 20
2 1 865584 297 0
3 1 865665 296 0
4 1 865700 297 0
6 10 865662 297 0
7 10 866429 297 0
8 11 865694 293 1
9 11 866438 297 0
5 2 865628 292 5
10 22 865625 297 0
0 Z 762320 296 1
11 Z 861349 297 0