Importing Data in Java
Anthony Markham
VP Quant Developer
Table employees = Table.create("Employees");
StringColumn nameCol = StringColumn.create("Name");
Row firstRow = employees.row(0);
String tableName = employees.name();
employees
// Row and column counts
int rowCount = employees.rowCount();
int columnCount = employees.columnCount();
1000
5
StringColumn - Text dataIntColumn, DoubleColumn - Numeric valuesBooleanColumn - True/False valuesDateColumn - calendar dates (2024-03-05)DateTimeColumn - datetime (2024-03-05T14:32)// Using .mean() on DoubleColumn
DoubleColumn salary = employees.column("Salary");
double averageSalary = salary.mean();
// Get a specific column StringColumn names = employees.stringColumn("Name");// Get a general column names = employees.column("Name");// Get a value from a column String firstPerson = names.get(0);// Get an entire row Row firstRow = employees.row(0);// Get a value from a row double salary = firstRow.getDouble("Salary");
.isGreaterThan(), .isLessThan().isEqualTo().isAfter()$$
// Create a selection of rows
Selection highEarners = employees.doubleColumn("Salary")
.isGreaterThan(70000);
// Create a selection of rows Selection highEarners = employees.doubleColumn("Salary") .isGreaterThan(70000);// Apply selection to get a filtered table Table highPaidEmployees = employees.where(highEarners);
$$
$$
.where() returns a new table.and() and .or()Selection recentHires = employees.dateColumn("HireDate") .isAfter(LocalDate.of(2020, 1, 1));Selection highPaidRecent = highEarners.and(recentHires);
Importing Data in Java