I have successfully connected Python to Microsoft Access Database. The problem appears when I am trying to sort the column labels in the data frame by number in increasing order. The column names also contain characters.
I have looked into several sorting functions, but none of them seems to work for this issue.
My data frame is as follows;
C1 C10 C11 C12 C13 C14 ... C2 C20 C21 ... C3 ...
How I want my columns to be sorted;
C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 ...
My data frame also contain other component, such as benzene, toluene, etc, so I would like the list to be in alphabetic order too.
Moreover, is there a way to sort it as;
... C4 C5 iC5 nC5 C6 iC6 nC6.
The above question is most important, but if someone know if/how this can be done, please advice be!
On beforehand, thanks for your help!
| Prefix | Code |where prefix isiorn(or nothing), and Code is likeC4.natsortedis what you want here for the first case. See stackoverflow.com/questions/57203726/…. The second seems to be a bit vague, is there a way to distinguish thatiis a prefix and thatCis not?