Skip to content

How to customize column names after summarizing is completed #1258

Open
@HoasZhang

Description

@HoasZhang

I hope that the results calculated by grouping and aggregating by column names can be customized with column names. I am doing this now, but I hope there can be a better way to implement it.

Table clazz =
            Table.create("Class")
                    .addColumns(
                            StringColumn.create("Class Name", className),
                            IntColumn.create("Class No", classNo));

    Table students =
            Table.create("Student")
                    .addColumns(
                            StringColumn.create("Student Name", studentName),
                            IntColumn.create("class No", studentClassNo),
                            DoubleColumn.create("student Score", studentScore));


    System.out.println(clazz.print());
    System.out.println(students.print());


    Table studentJoiner = students.joinOn("class No").inner( clazz );
    System.out.println(studentJoiner.print());

    Table table1 = studentJoiner.summarize("student Score", max, min)
            .by("class No");

    table1.column( 1 ).setName("Max Score");
    table1.column( 2 ).setName("Min Score");

    System.out.println(table1.print());

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions