शुरू करेंमुफ़्त में शुरू करें

Datetime कॉम्पोनेंट निकालना

volunteer डेटासेट में कई कॉलम datetimes से बने हैं। आइए start_date_date कॉलम पर नज़र डालें और सिर्फ़ month निकालें ताकि उसे मॉडलिंग के लिए एक फीचर के रूप में इस्तेमाल किया जा सके.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Machine Learning के लिए Preprocessing

पाठ्यक्रम देखें

अभ्यास निर्देश

  • start_date_date कॉलम को pandas datetime कॉलम में कन्वर्ट करें और उसे start_date_converted नाम के नए कॉलम में स्टोर करें.
  • start_date_converted के month कॉम्पोनेंट को निकालें और उसे start_date_month नाम के नए कॉलम में स्टोर करें.
  • सिर्फ़ start_date_converted और start_date_month कॉलम का .head() प्रिंट करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# First, convert string column to date column
volunteer["start_date_converted"] = pd.____(____)

# Extract just the month from the converted column
volunteer["start_date_month"] = volunteer[____].____

# Take a look at the converted and new month columns
print(volunteer[[____, ____]].____)
कोड संपादित करें और चलाएँ