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 - 文本数据IntColumn、DoubleColumn - 数值BooleanColumn - 布尔值DateColumn - 日历日期(2024-03-05)DateTimeColumn - 日期时间(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() 返回一个新的表.and() 和 .or() 组合选择集Selection recentHires = employees.dateColumn("HireDate") .isAfter(LocalDate.of(2020, 1, 1));Selection highPaidRecent = highEarners.and(recentHires);
Java 中的数据导入