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

दिनों में समय का ऑफ़सेट निकालें - भाग 1

हर ट्रांज़ैक्शन के लिए time offset निकालने से आप हर cohort के मेट्रिक्स को तुलनीय तरीके से रिपोर्ट कर सकते हैं.

सबसे पहले, हम 6 वैरिएबल बनाएँगे जो Invoice और Cohort Date के लिए years, months और days का integer मान कैप्चर करें. इसके लिए पहले से परिभाषित get_date_int() फंक्शन का उपयोग कीजिए:

def get_date_int(df, column):
    year = df[column].dt.year
    month = df[column].dt.month
    day = df[column].dt.day
    return year, month, day

online डेटा लोड किया जा चुका है. आप online.head() कॉल करके इसका हैडर कंसोल पर प्रिंट कर सकते हैं.

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

Python में Customer Segmentation

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

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

  • InvoiceDay कॉलम पर get_date_int फंक्शन कॉल करके invoice_year, invoice_month, invoice_day ऑब्जेक्ट बनाएँ.
  • CohortDay कॉलम पर get_date_int फंक्शन कॉल करके cohort_year, cohort_month, cohort_day ऑब्जेक्ट बनाएँ.

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

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

# Get the integers for date parts from the `InvoiceDay` column
____, ____, ____ = get_date_int(____, ____)

# Get the integers for date parts from the `CohortDay` column
____, ____, ____ = get_date_int(____, ____)
कोड संपादित करें और चलाएँ