class SeriesGroupBy {

    public Series<T> toSeries() {
        IntSeries index = SeriesConcat.intConcat(groupsIndex.values());

        // this should hopefully preserve the nature of any primitive-based Series
        return ungrouped.select(index);
    }

    public  SeriesGroupBy(Series<T> ungrouped, Map<Object, IntSeries> groupsIndex);

}