BUG: stable sort of group_index in groupby