I have a DataFrame in python, the cell value is the purchase quantity like:
code 1/18 2/18 3/18 4/18 5/18
1 NaN 15 15 16 14
2 NaN NaN 30 23 24
3 24 21 23 NaN 26
I want to order the code in terms of the date they were first purchased, the result would be:
code 1/18 2/18 3/18 4/18 5/18
3 24 21 23 NaN 26
1 NaN 15 15 16 14
2 NaN NaN 30 23 24
Please help!