Initial data exploration
You're a new data analyst at TechCorp. HR needs a focused view of high earners for budget planning, but the full employee table has dozens of columns. Selecting only relevant columns reduces noise and makes your analysis clearer for you and stakeholders reviewing your results.
The Table and related Tablesaw classes have been imported for you.
Este ejercicio forma parte del curso
Importing Data in Java
Instrucciones del ejercicio
- Select columns:
"Name","Department","JobTitle","Salary","Age". - Filter for salaries above $60,000.
- Sort by salary descending.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
public class DataExploration {
public static void main(String[] args) {
try {
Table employees = Table.read().csv("employees.csv");
// Select the essential columns
Table essentialData = employees.____("Name", "Department", "JobTitle", "Salary", "Age");
// Filter for salaries above $60,000
Table highEarners = essentialData.____(
essentialData.intColumn("____").____(60000));
// Sort by salary descending
Table sortedHighEarners = highEarners.____("____");
System.out.println("Top 10 Highest Earning Employees:");
System.out.println(sortedHighEarners.first(10));
} catch (Exception e) {
System.err.println("Error reading CSV files: " + e.getMessage());
}
}
}