pyfreya package

Submodules

pyfreya.pyfreya module

Main module.

pyfreya.pyfreya.create_cohort(new_users, days_since_install=None, retention_values=None, retention_function='power', retention_profile=None, start_date=1, revenue_profile=None, name='')[source]

Creates a cohort class. “new_users” parameter must be provided. Retention information must also be provided, by either: add retention values and days since install values or supply a pre-made retention profile - see Retention. A revenue profile can also be attached to a cohort - see Short Tutorial in the Revenue Classes..

The main variables of the class to keep track of is:

  • df_user_dist: Contains information about the user by days since install (index of the pandas dataframe) and date (column of the pandas dataframe).
  • df_dau: Contains information about daily active user and revenue. The index is date and the columns are dau, revenue and revenueUnc. Assuming each measure have been calculated.
Parameters:
  • new_users – The amount of starting users.
  • days_since_install (Optional[List[int]]) – The days since install values to go along with retention_values.
  • retention_values (Optional[List[Union[float, Variable]]]) – The retention values to go along with days_since_install.
  • retention_function – Function to fit the retention to.
  • retention_profile (Optional[Retention]) – A premade retention profile using the Retention class.
  • start_date (Union[datetime, date, int]) – The start date of the first cohort.
  • revenue_profile (Optional[BaseRevenue]) – A revenue profile object who had inherited its behaviour after BaseRevenue.
  • name – Name of cohort - is mostly used as identifier when working with multiple cohorts.
Returns:

pyfreya.pyfreya.create_retention(days_since_install, retention_values)[source]

Creates a retention profile that can be used in cohorts.

Parameters:
  • days_since_install (List[int]) – Days since install that accompanies the retention values.
  • retention_values (List[Union[float, Variable]]) – Retention values can either be formatted in values below like
>>> [0.5, 0.05, 0.01]

or

>>> [50, 5, 1]

for values 50%, 5% and 1%. :return:

pyfreya.pyfreya.load_class(filename)[source]
Parameters:filename (str) –
Returns:
pyfreya.pyfreya.multi_cohort_dau_plot(cohorts, kind='line')[source]

Plot DAU by date for each cohort. With kind=’line’ a line plot is used, where all values are plotted from 0. With kind=’bar’ a stacked bar plot is used, meaning each value on each date is placed on top of each other.

Parameters:
  • cohorts (List[Cohort]) – List of cohotrs.
  • kind – Type of plot, choose between line (default) and bar.
Returns:

pyfreya.pyfreya.multi_cohort_ret_plot(cohorts)[source]

Plot retention for multiple cohorts.

Parameters:cohorts (List[Cohort]) – List of cohorts.
Returns:
pyfreya.pyfreya.multi_cohort_rev_plot(cohorts, kind='line', cumulative=True)[source]

Plot revenue from multiple cohorts. With kind=’line’ a line plot is used, where all revenue is plotted from 0. With kind=’bar’ a stacked bar plot is used, meaning each revenue on each date is placed on top of each other.

Parameters:
  • cohorts (List[Cohort]) – List of cohorts.
  • kind – Type of plot, choose between line (default) and bar.
  • cumulative – Denotes if the cumulative lines should be included.
Returns:

pyfreya.pyfreya.save_class(filename, class_instance)[source]
Parameters:
  • filename (str) –
  • objet
Returns:

Module contents

Top-level package for PyFreya.