I have a dataset in the below format. id A B C D E 100 1 0 0 0 0 101 0 1 1 0 0 102 1 0 0 0 0 103 0 0 0 1 1 I would like to convert this into below: 100, A 101, B C 102, A 103, D E How do I do this ? I tried numpy argsort but I am new to Python and finding this challenging. Appreciate any help in this.