การนำเข้าข้อมูลใน 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 - ค่า True/FalseDateColumn - วันที่ตามปฏิทิน (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() คืนค่าเป็น table ใหม่.and() และ .or()Selection recentHires = employees.dateColumn("HireDate") .isAfter(LocalDate.of(2020, 1, 1));Selection highPaidRecent = highEarners.and(recentHires);
การนำเข้าข้อมูลใน Java