return indices of grouped rows