indices should be 0-based as with group_by