I have a large pandas dataframe, I need to sort each row in a loop, the sort should reflect on the heading. The code is fine but it is really slow. I tried to convert pandas to NumPy 2d array, it gets a little improvement but still slow.
In my code, I have NumPy matrix, and I select one row each time and sort it with the first row. I used argsort. Is there any way to speedup the code, any suggestion?