add groupby_attr and groupby_key functions