Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cohort generation #12

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aurelion314
Copy link

Generate data in a form usable by theseus.

I found that forming my data into something usable by theseus was not always a quick process, so I've added code to help do that.

A new cohort class takes raw data and builds cohort trends. The cohort object can then be passed to theseus.create_profile() for further analysis by theseus.

You can use either activity/usage data, or unique user data.
Activity data would be many rows per user, each indicating usage on some date. Duplicates are ignored. The first appearance of a user becomes their cohort.
Unique user data would be one row per user, with 2 date fields. One is their start date which becomes their cohort, and the second is their churn date. If churn date is empty then they are treated as still active.

ex:

import theseus_growth as th
th = th.theseus()
data = [
    {'name': "Johnny", 'start_date': '2019-01-01','churn_date': '2019-03-01'},
    {'name': "Mike", 'start_date': '2019-02-01','churn_date': '2019-10-01'},
    {'name': "Bob", 'start_date': '2019-01-01','churn_date': '2019-11-01'},
    {'name': "Jennifer", 'start_date': '2019-04-01','churn_date': '2019-10-01'},
    {'name': "James", 'start_date': '2019-04-01','churn_date': '2019-12-01'},
    ]

cohort = th.create_cohort(data, 'start_date', 'churn_date')
profile = th.create_profile(cohort)
th.plot_retention(profile, show_average_values=True)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant