डेटा क्लीनिंग और एन्हांसमेंट
TechCorp एक नए HR सिस्टम पर माइग्रेट कर रही है. डेटासेट को क्लीन करने की ज़रूरत है: कम सैलरी वाले आउट्लायर हटाएँ जो डेटा एंट्री एरर दिखाते हैं, वे कॉलम ड्रॉप करें जिन्हें नया सिस्टम इस्तेमाल नहीं करेगा, और एक कैलकुलेटेड बोनस फ़ील्ड जोड़ें. डेटा क्लीनिंग आम तौर पर विश्लेषण समय का 80% लेती है—ये स्किल्स बेहद ज़रूरी हैं.
Table, Selection, और DoubleColumn क्लास आपके लिए इम्पोर्ट कर दी गई हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Java में डेटा इम्पोर्ट करना
अभ्यास निर्देश
- जिन कर्मचारियों की सैलरी $40,000 से कम है, उन्हें हटा दें.
"JobTitle"कॉलम हटाएँ.PerformanceBonusकॉलम जोड़ें (सैलरी का 5%).
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
public class DataExploration {
public static void main(String[] args) {
Table employees = Table.read().csv("employees.csv");
// Remove employees with salaries below $40,000
Selection lowSalaries = employees.intColumn("Salary").isLessThan(____);
Table cleanedEmployees = employees.____(lowSalaries);
// Remove the JobTitle column
Table streamlined = cleanedEmployees.____("JobTitle");
DoubleColumn performanceBonus = streamlined.intColumn("Salary").asDoubleColumn()
.map(salary -> salary * 0.05);
performanceBonus.setName("PerformanceBonus");
// Add the PerformanceBonus column
Table enhancedEmployees = streamlined.____(performanceBonus);
System.out.println("Total employees after cleaning: " + enhancedEmployees.rowCount());
System.out.println("\nFirst 5 rows of enhanced dataset:");
System.out.println(enhancedEmployees.first(5));
}
}