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

शुरू से retention rate की गणना करें

आपने देखा कि मासिक acquisition cohorts के लिए retention और average quantity मेट्रिक्स टेबल कैसे बनाते हैं. अब बारी आपकी है कि आप खुद retention मेट्रिक्स तैयार करें.

इस लेसन में online डेटासेट आपको लोड करके दिया गया है, जिसमें monthly cohorts और cohort index असाइन हैं. चाहें तो इसे Console में प्रिंट कर सकते हैं.

साथ ही, हमने यह कमांड चलाकर grouping DataFrame के रूप में एक groupby ऑब्जेक्ट भी बना और लोड कर दिया है: grouping = online.groupby(['CohortMonth', 'CohortIndex'])

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

Python में Customer Segmentation

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

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

  • customer ID वाला कॉलम चुनें, उसके unique मानों की गिनती करें, उसे cohort_data के रूप में स्टोर करें और उसका index रीसेट करें.
  • एक pivot बनाएँ जिसमें index में monthly cohort, columns में cohort index और values में customer ID हो.
  • पहली कॉलम चुनें और उसे cohort_sizes में स्टोर करें.
  • पंक्तियों के entlang cohort count को cohort sizes से विभाजित करें.

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

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

# Count the number of unique values per customer ID
cohort_data = grouping[____].apply(pd.Series.____).reset_index()

# Create a pivot 
cohort_counts = cohort_data.____(index=____, columns=____, values=____)

# Select the first column and store it to cohort_sizes
cohort_sizes = cohort_counts.iloc[:,____]

# Divide the cohort count by cohort sizes along the rows
retention = cohort_counts.____(____, axis=____)
कोड संपादित करें और चलाएँ