GroupBy { public DataFrame toDataFrame() { IntSeries index = SeriesConcat.intConcat(groupsIndex.values()); return ungrouped.selectRows(index); } GroupBy(DataFrame ungrouped, Map<Object, IntSeries> groupsIndex, Comparator<RowProxy> sorter); int size(); Index getUngroupedColumnIndex(); DataFrame toDataFrame(); Collection<Object> getGroups(); boolean hasGroup(Object key); IntSeries getGroupIndex(Object key); DataFrame getGroup(Object key); @Deprecated Series<Integer> rowNumbers(); IntSeries rowNumber(); IntSeries rank(); IntSeries denseRank(); Series<T> shift(String column, int offset, T filler); Series<T> shift(int column, int offset, T filler); GroupBy head(int len); GroupBy tail(int len); GroupBy sort(RowToValueMapper<V> sortKeyExtractor); GroupBy sort(Comparator<RowProxy> sorter); GroupBy sort(String column, boolean ascending); GroupBy sort(int column, boolean ascending); GroupBy sort(String[] columns, boolean[] ascending); GroupBy sort(int[] columns, boolean[] ascending); DataFrame agg(Aggregator<?>... aggregators);  }
@Test public void testGroup_toDataFrame() { DataFrame df1 = DataFrame.newFrame("a", "b").foldByRow( 1, "x", 2, "y", 1, "y", 0, "a", 1, "x"); DataFrame df = df1.group("a").toDataFrame(); new DataFrameAsserts(df, "a", "b") .expectHeight(5) .expectRow(0, 1, "x") .expectRow(1, 1, "y") .expectRow(2, 1, "x") .expectRow(3, 2, "y") .expectRow(4, 0, "a"); }