groupby matching with order