Package tech.tablesaw.aggregate
Class PivotTable
java.lang.Object
tech.tablesaw.aggregate.PivotTable
PivotTable is used to 'rotate' a source table such that it is summarized on the values of some
column. As implemented here, you supply: - a "key" categorical column from which the primary
grouping is created, there will be one on each row of the result - a second categorical column
for which a subtotal is created; this produces n columns on each row of the result - one column
for each unique value - a numeric column that provides the values to be summarized - an
aggregation function that defines what operation is performed on the values in the subgroups
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Table
pivot
(Table table, CategoricalColumn<?> column1, CategoricalColumn<?> column2, NumericColumn<?> values, AggregateFunction<?, ?> aggregateFunction) Returns a table that is a rotation of the given table pivoted around the key columns, and filling the output cells using the values calculated by theaggregateFunction
when applied to thevalues column
grouping by the key columns
-
Constructor Details
-
PivotTable
public PivotTable()
-
-
Method Details
-
pivot
public static Table pivot(Table table, CategoricalColumn<?> column1, CategoricalColumn<?> column2, NumericColumn<?> values, AggregateFunction<?, ?> aggregateFunction) Returns a table that is a rotation of the given table pivoted around the key columns, and filling the output cells using the values calculated by theaggregateFunction
when applied to thevalues column
grouping by the key columns- Parameters:
table
- The table that provides the data to be pivotedcolumn1
- A "key" categorical column from which the primary grouping is created. There will be one on each row of the resultcolumn2
- A second categorical column for which a subtotal is created; this produces n columns on each row of the resultvalues
- A numeric column that provides the values to be summarizedaggregateFunction
- function that defines what operation is performed on the values in the subgroups- Returns:
- A new, pivoted table
-