modelhub.Aggregate.funnel_conversion

funnel_conversion​

(data, location_stack=None, groupby=None)

​[source]

Calculates conversion numbers for all locations stacks in the data. N.B. Filter the dataframe beforehand to filter down to the funnel locations.

For each step in a funnel, calculates the number of unique users who started it, the number of unique users who completed the step (defined as whether the user went to any other step in the funnel), the conversion rate to completing the step, the conversion rate to completing the step when looking at all users who started the funnel (= the ‘full’ conversion rate), and the fraction of the users in the funnel dropping out at the given step.

N.B. We assumed that the funnel direction is always the same. The implementation of VisibleEvents makes for the most accurate calculation of the conversion numbers, as the number of users as well as the conversion rate is based on events on each location stack.

Parameters​

If its value is None, the whole location stack is taken.

  • groupby (Optional[Union[str, List[str]]]) – sets the column(s) to group by. It would be also handy later for the filtering of the results.

Returns​

bach.DataFrame with the following columns: step (the location considered as a step, e.g. a feature or root location), n_users (number of unique users starting the step), n_users_completed_step (number of unique users completing the step), step_conversion_rate (number of users completing the step / n_users), full_conversion_rate (number of users completing the step / number of users starting the funnel), and dropoff_share (ratio between the users dropping out at a given step and users at the begging at the funnel).

Return type​

bach.dataframe.DataFrame