@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();
    // must be sorted by groups in the order they are encountered
    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");
}