Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to customize column names after summarizing is completed #1258

Open
HoasZhang opened this issue Jun 24, 2024 · 0 comments
Open

How to customize column names after summarizing is completed #1258

HoasZhang opened this issue Jun 24, 2024 · 0 comments

Comments

@HoasZhang
Copy link

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());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant