static Selection withRange(int startIndex, int endIndex)
Above method select element from startIndex (inclusive) to endIndex (exclusive).
package com.sample.app;
import tech.tablesaw.api.IntColumn;
import tech.tablesaw.selection.Selection;
public class App {
public static void main(String args[]) {
int[] numbers = { 2, 4, 103, 24, 53, 23, 12, 11, 56, 6 };
IntColumn intColumn = IntColumn.create("My Numbers", numbers);
IntColumn filteredElements = intColumn.where(Selection.withRange(3, 8));
System.out.println(intColumn.print() + "\n");
filteredElements.setName("Filtered Elements");
System.out.println(filteredElements.print());
}
}
Output
Column: My Numbers
2
4
103
24
53
23
12
11
56
6
Column: Filtered Elements
24
53
23
12
11
No comments:
Post a Comment