Nhập dữ liệu trong 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
// Số hàng và số cột
int rowCount = employees.rowCount();
int columnCount = employees.columnCount();
1000
5
StringColumn - Dữ liệu văn bảnIntColumn, DoubleColumn - Giá trị sốBooleanColumn - Giá trị Đúng/SaiDateColumn - ngày lịch (2024-03-05)DateTimeColumn - ngày giờ (2024-03-05T14:32)// Dùng .mean() trên DoubleColumn
DoubleColumn salary = employees.column("Salary");
double averageSalary = salary.mean();
// Lấy một cột cụ thể StringColumn names = employees.stringColumn("Name");// Lấy cột kiểu tổng quát names = employees.column("Name");// Lấy một giá trị từ cột String firstPerson = names.get(0);// Lấy toàn bộ một hàng Row firstRow = employees.row(0);// Lấy giá trị từ một hàng double salary = firstRow.getDouble("Salary");
.isGreaterThan(), .isLessThan().isEqualTo().isAfter()$$
// Tạo Selection các hàng
Selection highEarners = employees.doubleColumn("Salary")
.isGreaterThan(70000);
// Tạo Selection các hàng Selection highEarners = employees.doubleColumn("Salary") .isGreaterThan(70000);// Áp dụng Selection để lọc bảng Table highPaidEmployees = employees.where(highEarners);
$$
$$
.where() trả về một bảng mới.and() và .or()Selection recentHires = employees.dateColumn("HireDate") .isAfter(LocalDate.of(2020, 1, 1));Selection highPaidRecent = highEarners.and(recentHires);
Nhập dữ liệu trong Java