टेबल मेटाडेटा का अन्वेषण
वेधर डेटा टेबल बनाने के बाद, रिपोर्ट जनरेट करने से पहले मौसम-विज्ञान टीम को इसकी संरचना समझनी है. टीम लीड ने आपसे टेबल के आयाम, कॉलम, और डेटा का एक प्रीव्यू साझा करने को कहा है.
Tablesaw से Table, DoubleColumn, और StringColumn क्लास आपके लिए इम्पोर्ट कर दी गई हैं.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Java में डेटा इम्पोर्ट करना
अभ्यास निर्देश
- टेबल के आयाम प्रिंट करें.
- कॉलम नाम दिखाएँ.
- टेबल की संरचना प्रिंट करें.
- पहली तीन रो का प्रीव्यू दिखाएँ.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
public class WeatherMetadataExample {
public static void main(String[] args) {
StringColumn days = StringColumn.create("Day",
"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
DoubleColumn temperatures = DoubleColumn.create("Temperature",
22.5, 24.0, 23.2, 21.5, 20.8, 25.1, 26.3);
DoubleColumn precipitation = DoubleColumn.create("Precipitation",
0.0, 2.5, 5.2, 0.0, 0.0, 1.3, 0.0);
Table weatherData = Table.create("WeatherData")
.addColumns(days, temperatures, precipitation);
// Print the table dimensions
System.out.println(____.____());
// Display the column names
System.out.println(____.____());
// Print the table structure
System.out.println(____.____());
// Preview the first three rows
System.out.println(____.____(____));
}
}