I have the following multi-index dataframe set up:
created_at ... compound
conv_nr elem_nr ...
0 0 2020-03-30 18:41:32+00:00 ... 0.7184
1 2020-03-30 18:31:47+00:00 ... -0.0003
1 0 2020-03-30 18:35:15+00:00 ... -0.3612
1 2020-03-30 18:34:00+00:00 ... 0.1877
2 2020-03-30 18:29:36+00:00 ... -0.1027
... ... ... ...
29071 1 2019-05-22 12:58:12+00:00 ... 0.0000
29072 0 2019-05-22 13:20:31+00:00 ... -0.6619
1 2019-05-22 12:58:12+00:00 ... 0.0000
29073 0 2019-05-22 13:20:05+00:00 ... 0.7506
1 2019-05-22 12:58:12+00:00 ... 0.0000
I am struggling to order this so that the time stamps are in ascending order and that "elem_nr" is also reindexed accordingly (stays in tact). Consider when conv_nr = 0. The outcome should then be:
created_at ... compound
conv_nr elem_nr ...
0 0 2020-03-30 18:31:47+00:00 ... -0.0003
1 2020-03-30 18:41:32+00:00 ... 0.7184
So essentially I need to get ascending timestamps while ensuring the "elem_nr" does not get flipped/stays in place.
conv_nrgroup?