Interpolations का प्लॉट बनाएँ
इम्प्यूटेशन की तुलना करने वाले ग्राफ बनाना, सबसे उपयुक्त इम्प्यूटेशन तकनीक समझने के लिए ज़रूरी है। इस अभ्यास में, आप कई इम्प्यूटेशन तकनीकों के लिए प्लॉट बनाने हेतु एक for loop लिखेंगे। आप पिछले पाठ में किए गए इम्प्यूटेशनों — यानी linear, quadratic, और nearest interpolation तकनीकों — के प्लॉट बनाएँगे।
तीन DataFrame, जिनके नाम उनकी इम्प्यूटेशन तकनीकों पर रखे गए हैं, आपके लिए पहले से इम्पोर्ट किए गए हैं: linear_interp, quadratic_interp, और nearest_interp.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Missing Data से निपटना
अभ्यास निर्देश
- प्रत्येक इम्प्यूटेशन तकनीक के लिए 3 subplots बनाएँ।
linear_interp,quadratic_interp, औरnearest_interpDataFrame को संबंधित interpolation तकनीक से मैप करकेinterpolationsडिक्शनरी बनाएँ।axesऔरinterpolationsपर loop चलाएँ।interpolationsमें से प्रत्येक DataFrame चुनें औरdf_keyका उपयोग करके उस DataFrame का शीर्षक सेट करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Set nrows to 3 and ncols to 1
fig, axes = plt.subplots(___, ___, figsize=(30, 20))
# Create a dictionary of interpolated DataFrames for looping
interpolations = {'Linear Interpolation': ___, 'Quadratic Interpolation': ___,
'Nearest Interpolation': ___}
# Loop over axes and interpolations
for ax, df_key in zip(___, ___):
# Select and also set the title for a DataFrame
interpolations[___].Ozone.plot(color='red', marker='o', linestyle='dotted', ax=ax)
airquality.Ozone.plot(title=___ + ' - Ozone', marker='o', ax=ax)
plt.show()