Package tech.tablesaw.table
Class RollingColumn
- java.lang.Object
-
- tech.tablesaw.table.RollingColumn
-
- Direct Known Subclasses:
NumberRollingColumn
public class RollingColumn extends Object
Does a calculation on a rolling basis (e.g. mean for last 20 days)
-
-
Constructor Summary
Constructors Constructor Description RollingColumn(Column<?> column, int window)
Constructs a rolling column based on calculations on a sliding window ofwindow
rows of data from the given column
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <INCOL extends Column<?>,OUT>
Column<?>calc(AggregateFunction<INCOL,OUT> function)
Performs the calculation and returns a new column containing the resultsprotected String
generateNewColumnName(AggregateFunction<?,?> function)
Generates a name for the column based on the name of the original column and the function used in the calculation
-
-
-
Field Detail
-
column
protected final Column<?> column
The column providing the data for the rolling calculation
-
window
protected final int window
The size of the rolling window
-
-
Constructor Detail
-
RollingColumn
public RollingColumn(Column<?> column, int window)
Constructs a rolling column based on calculations on a sliding window ofwindow
rows of data from the given column
-
-
Method Detail
-
generateNewColumnName
protected String generateNewColumnName(AggregateFunction<?,?> function)
Generates a name for the column based on the name of the original column and the function used in the calculation
-
calc
public <INCOL extends Column<?>,OUT> Column<?> calc(AggregateFunction<INCOL,OUT> function)
Performs the calculation and returns a new column containing the results
-
-